Earnify is a gamified rewards platform that turns your restaurant receipts into points. Compete on leaderboards, earn rewards, and redeem exclusive discounts at your favorite restaurants. Make dining out even more exciting!
- Receipt Upload: Snap a picture of your receipt or upload it to earn points.
- Leaderboards: Compete with other users and climb the ranks for each restaurant.
- Rewards: Redeem your points for discounts and special offers.
- User-Friendly: Modern and responsive UI for both web and mobile users.
- Framework: React with TypeScript
- Styling: Tailwind CSS
- File Upload: React Dropzone
- Framework: Node.js with Express
- Language: TypeScript
- Database: PostgreSQL (managed by Prisma ORM)
- Authentication: JSON Web Tokens (JWT)
- OCR Integration: Google Cloud Vision API
- Frontend: Vercel
- Backend: Render / Heroku
- Database: Hosted PostgreSQL (e.g., Supabase or PlanetScale)
- Node.js (v16+)
- PostgreSQL
- Yarn or npm
-
Clone the Repository:
git clone https://github.com/your-username/earnify.git cd earnify
-
Install Dependencies:
# For both frontend and backend cd frontend yarn install cd ../backend yarn install
-
Configure Environment Variables: Create
.env
files for both the frontend and backend with the following:REACT_APP_API_URL=http://localhost:5000
DATABASE_URL=postgresql://<user>:<password>@localhost:5432/earnify JWT_SECRET=your_jwt_secret GOOGLE_CLOUD_API_KEY=your_google_cloud_api_key
-
Setup Database: Run Prisma migrations to set up your database schema:
cd backend npx prisma migrate dev
-
Start the Development Servers:
# Start the backend cd backend yarn dev # Start the frontend cd ../frontend yarn start
-
Access the App:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
frontend/
├── src/
│ ├── components/ # Reusable React components
│ ├── pages/ # Main pages (e.g., Home, Profile, Leaderboard)
│ ├── styles/ # Tailwind CSS styles
│ ├── utils/ # Utility functions
│ └── App.tsx # App entry point
├── public/ # Static assets
├── package.json # Frontend dependencies
backend/
├── src/
│ ├── controllers/ # Business logic (auth, receipts, rewards)
│ ├── routes/ # API route handlers
│ ├── prisma/ # Database schema and migrations
│ ├── middleware/ # Authentication and validation middleware
│ ├── utils/ # Helper functions (e.g., OCR, JWT)
│ └── server.ts # Server entry point
├── .env # Backend environment variables
├── package.json # Backend dependencies
POST /api/auth/register
: Register a new user.POST /api/auth/login
: Authenticate and return a JWT.
POST /api/receipts
: Upload a receipt to earn points.GET /api/receipts
: Get the user's receipt history.
GET /api/leaderboard/:restaurantId
: Fetch the top 10 users for a specific restaurant.
GET /api/rewards
: List available rewards.POST /api/rewards/redeem
: Redeem points for a reward.
Contributions are welcome! Follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature/fix:
git checkout -b feature-name
- Make your changes and commit them:
git commit -m "Add new feature"
- Push your branch and create a pull request.
git push origin feature-name
This project is licensed under the MIT License. See the LICENSE
file for details.
For any inquiries or feedback, reach out to: