A comprehensive digital identity platform for animals, designed to provide unique identification through pattern recognition and secure ownership documentation.
Scanimal is a full-stack web application that enables animal owners to register their animals with digital identities, helping with:
- Theft Prevention: Digital identity makes it difficult for stolen animals to be sold
- Ownership Verification: Provides verifiable proof of ownership
- Lost Animal Recovery: Helps reunite lost animals with their owners
- Agricultural Management: Supports better livestock management and breeding programs
- โ User authentication (Registration & Login)
- โ JWT-based secure authentication
- โ Animal registration with multiple image uploads
- โ User dashboard with profile management
- โ Animal listing and search functionality
- โ Responsive web design
- โ MongoDB database integration
- ๐ Deep learning pattern recognition
- ๐ Computer vision processing (OpenCV/TensorFlow)
- ๐ High-accuracy pattern matching
- ๐ Mobile app integration
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database (local MongoDB)
- Mongoose - ODM for MongoDB
- JWT - Authentication tokens
- bcryptjs - Password hashing
- Multer - File upload handling
- HTML5 - Structure
- CSS3 - Styling
- Vanilla JavaScript - Interactivity
- Fetch API - Backend communication
Before running the project, ensure you have:
- Node.js (v14 or higher) - Download
- MongoDB (local installation) - Download
- MongoDB Compass (optional, for database management) - Download
cd scanimalnpm installThis will install:
- express
- mongoose
- jsonwebtoken
- bcryptjs
- multer
- cors
- dotenv
- Open MongoDB Compass
- Connect to
mongodb://127.0.0.1:27017 - Create a new database named
animalDB(or it will be created automatically)
mongosh
use animalDBCreate a .env file in the root directory:
MONGODB_URI=mongodb://127.0.0.1:27017/animalDB
JWT_SECRET=your_secret_key_here
PORT=3000
NODE_ENV=developmentNote: If you don't create a .env file, the application will use default values.
The uploads directory will be created automatically when you register your first animal. However, you can create it manually:
mkdir uploadsnpm startOr for development:
npm run devThe server will start on http://localhost:3000
Open your web browser and navigate to:
http://localhost:3000
scanimal/
โโโ server.js # Main Express server
โโโ package.json # Dependencies and scripts
โโโ .gitignore # Git ignore file
โโโ .env.example # Environment variables example
โ
โโโ models/ # Mongoose models
โ โโโ User.js # User schema
โ โโโ Animal.js # Animal schema
โ
โโโ routes/ # API routes
โ โโโ auth.js # Authentication routes
โ โโโ animals.js # Animal routes
โ โโโ users.js # User routes
โ
โโโ middleware/ # Custom middleware
โ โโโ auth.js # JWT authentication middleware
โ
โโโ uploads/ # Uploaded animal images (created automatically)
โ
โโโ assets/ # Static assets (images, logos)
โ
โโโ index.html # Homepage
โโโ login.html # Login page
โโโ register-user.html # User registration page
โโโ register.html # Animal registration page
โโโ dashboard.html # User dashboard
โโโ identify.html # Animal identification page
โโโ animals-list.html # Animals listing page
โโโ script.js # Frontend JavaScript
โโโ styles.css # Stylesheet
POST /api/auth/register- Register a new userPOST /api/auth/login- Login user
POST /api/animals/register- Register a new animal (requires auth)GET /api/animals- Get all animals (with optional filters)GET /api/animals/:id- Get animal by IDGET /api/animals/image/:filename- Get animal imagePOST /api/animals/identify- Identify animal (future AI implementation)
GET /api/users/me- Get current user profile (requires auth)GET /api/users/dashboard- Get dashboard data (requires auth)GET /api/users/animals- Get user's animals (requires auth)
- Registration: Create a new account at
/register-user.html - Login: Login at
/login.html - Dashboard: View profile and registered animals at
/dashboard.html - Register Animal: Register a new animal at
/register.html(requires login) - View Animals: Browse all registered animals at
/animals-list.html - Identify Animal: Upload image to identify an animal at
/identify.html
- Password Hashing: All passwords are hashed using bcrypt
- JWT Authentication: Secure token-based authentication
- Protected Routes: Animal registration requires authentication
- Input Validation: Server-side validation for all inputs
- File Upload Security: Only image files are accepted, with size limits
{
name: String,
email: String (unique),
password: String (hashed),
role: String (user/admin),
createdAt: Date
}{
ownerId: ObjectId (ref: User),
animalType: String (cow/buffalo/goat/other),
breed: String,
gender: String (male/female),
color: String,
markings: String,
description: String,
images: [String], // Array of filenames
patternVector: [Number], // Future AI feature
registeredAt: Date
}- Responsive Design: Works on desktop, tablet, and mobile
- Modern UI: Clean and professional interface
- Real-time Updates: Dynamic content loading
- Error Handling: User-friendly error messages
- Authentication State: Automatic UI updates based on login status
- Integration of OpenCV for image processing
- Deep learning models for pattern extraction
- Feature vector generation and storage
- Similarity matching algorithms
- High-accuracy identification
- Mobile application
- Advanced search and filtering
- Animal health records
- Breeding history tracking
- Export/import functionality
- Admin dashboard
- Ensure MongoDB is running:
mongodor check MongoDB service - Verify connection string:
mongodb://127.0.0.1:27017/animalDB - Check MongoDB Compass connection
- Change PORT in
.envfile - Or kill the process using port 3000
- Ensure
uploads/directory exists and has write permissions - Check file size (max 5MB per image)
- Verify file type (only images allowed)
This project is created for educational purposes as a university final-year project.
- The project is designed to be AI-ready with clear integration points
- Pattern vectors are stored but not yet populated (awaiting AI implementation)
- All code is well-commented for educational purposes
- The structure follows best practices for scalability
This is a university project. For questions or suggestions, please contact the project maintainer.
Built with โค๏ธ for animal protection and agricultural development