From ccd7f0376550559e2b19052ed4d8f2ef1ee218c5 Mon Sep 17 00:00:00 2001 From: Vaishnavi10706 Date: Sat, 6 Jun 2026 10:13:10 +0530 Subject: [PATCH] docs: add centralized REST API reference to README --- README.md | 220 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 143 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index e01c1018..af15488e 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ Most productivity tools are either too bloated or too simple. **DailyForge** is a no-nonsense weekly planner that gives you total control over your schedule β€” built by students, for students and professionals alike. **What it does:** + - Build a reusable **task library** with custom durations, colors, and categories - Design **weekly routines** by dragging tasks into a visual time grid - Save, update, and delete **routines** with one click @@ -50,6 +51,7 @@ Most productivity tools are either too bloated or too simple. **DailyForge** is Most people don't fail to plan β€” they fail to stick to a plan. DailyForge makes routines feel visual and deliberate, making habits easier to build and track. **Key highlights:** + - ⚑ Drag-and-drop weekly planner powered by `@dnd-kit` - πŸ”’ Secure JWT authentication with bcrypt password hashing - πŸ—‚οΈ Reusable routine templates to clone and reuse schedules @@ -60,10 +62,10 @@ Most people don't fail to plan β€” they fail to stick to a plan. DailyForge make ## 🌐 Live Demo -| Service | URL | -|----------|-----| -| πŸ–₯️ Frontend | [https://dailyforge-frontend-lhjq.onrender.com](https://dailyforge-frontend-lhjq.onrender.com) | -| βš™οΈ Backend API | [https://dailyforge-backend.onrender.com](https://dailyforge-backend.onrender.com) | +| Service | URL | +| -------------- | ---------------------------------------------------------------------------------------------- | +| πŸ–₯️ Frontend | [https://dailyforge-frontend-lhjq.onrender.com](https://dailyforge-frontend-lhjq.onrender.com) | +| βš™οΈ Backend API | [https://dailyforge-backend.onrender.com](https://dailyforge-backend.onrender.com) | > ⚠️ Deployed on Render's free tier β€” first load may take 30–60 seconds to spin up. @@ -72,21 +74,25 @@ Most people don't fail to plan β€” they fail to stick to a plan. DailyForge make ## ✨ Features ### πŸ” Authentication + - Signup / Login with JWT-based session management - Protected routes β€” unauthenticated users are redirected to login - Passwords hashed with bcrypt ### πŸ“‹ Task Management + - Create tasks with: title, duration, color, and category - Edit and delete tasks from your personal task library - Tasks persist across sessions ### πŸ—“οΈ Routine Builder + - Drag tasks from your library onto a **7-day weekly grid** - Time-slot-based placement with visual feedback - Overlap detection prevents conflicting task placement on the same day ### πŸ“Š Dashboard + - **Interactive Contribution Heatmap**: A premium, GitHub-style 371-day productivity calendar that tracks consistency with stunning teal and glowing mint aesthetics. - **4-Level Visual Scale**: Cell intensities map to completed counts (1 task $\rightarrow$ low, 2 tasks $\rightarrow$ medium, 3+ tasks $\rightarrow$ perfect glowing mint). - **Streak & Productivity Tracking**: Real-time calculations of current streaks, longest streaks, total productive days, and average day-wise completion rate. @@ -98,6 +104,7 @@ Most people don't fail to plan β€” they fail to stick to a plan. DailyForge make - Summary stats for your weekly schedule and completion progress ### ♻️ Routine Templates + - Save any routine as a reusable template - Re-apply templates to any week in seconds @@ -106,30 +113,32 @@ Most people don't fail to plan β€” they fail to stick to a plan. DailyForge make ## πŸ— Tech Stack ### Frontend -| Technology | Purpose | -|------------|---------| -| React 19 | UI framework | -| Vite | Build tool & dev server | -| Tailwind CSS v4 | Utility-first styling | -| `@dnd-kit/core` | Drag-and-drop interactions | -| Axios | HTTP client for API calls | -| React Router DOM v7 | Client-side routing | -| Lucide React | Icon library | -| Context API | Global auth state management | -| Firebase Client | Google Sign-In authentication integration | + +| Technology | Purpose | +| ------------------- | ----------------------------------------- | +| React 19 | UI framework | +| Vite | Build tool & dev server | +| Tailwind CSS v4 | Utility-first styling | +| `@dnd-kit/core` | Drag-and-drop interactions | +| Axios | HTTP client for API calls | +| React Router DOM v7 | Client-side routing | +| Lucide React | Icon library | +| Context API | Global auth state management | +| Firebase Client | Google Sign-In authentication integration | ### Backend -| Technology | Purpose | -|------------|---------| -| Node.js | Runtime environment | -| Express.js v5 | REST API framework | -| MongoDB Atlas | Cloud database | -| Mongoose v9 | ODM for MongoDB | -| JSON Web Token (JWT) | Stateless authentication | -| Bcrypt | Password hashing | + +| Technology | Purpose | +| --------------------------- | -------------------------------------------- | +| Node.js | Runtime environment | +| Express.js v5 | REST API framework | +| MongoDB Atlas | Cloud database | +| Mongoose v9 | ODM for MongoDB | +| JSON Web Token (JWT) | Stateless authentication | +| Bcrypt | Password hashing | | Firebase token verification | RS256 Google ID token signature verification | -| dotenv | Environment variable management | -| Nodemon | Dev server with hot-reload | +| dotenv | Environment variable management | +| Nodemon | Dev server with hot-reload | --- @@ -215,13 +224,12 @@ npm install ```bash # Inside the /backend directory -cp .env.example .env +cp .env.example .env ``` Then fill in your values (see the next section for what each variable means). - -> ⚠️ **Local dev note:** The backend CORS origin is already configured for both the deployed frontend (`https://dailyforge-frontend-lhjq.onrender.com`) and local development (`http://localhost:5173`) in `backend/src/server.js`. No changes are needed for local development. +> ⚠️ **Local dev note:** The backend CORS origin is already configured for both the deployed frontend (`https://dailyforge-frontend-lhjq.onrender.com`) and local development (`http://localhost:5173`) in `backend/src/server.js`. No changes are needed for local development. **Start the backend dev server:** @@ -262,7 +270,6 @@ Open `http://localhost:5173`, sign up for an account, and start building your ro ## πŸ” Environment Variables - ### Backend β€” `backend/.env` Copy the provided template to get started. **Never commit the .env to git.** @@ -274,14 +281,15 @@ JWT_SECRET=your_super_secret_key_here #CLIENT_ORIGIN=your_deployed_frontend_url ``` -| Variable | Required | Description | -|----------|----------|-------------| -| `PORT` | βœ… | Port on which the Express server runs (default: `5000`) | -| `MONGO_URI` | βœ… | Full MongoDB Atlas connection string β€” get it from your Atlas cluster's "Connect" menu | -| `JWT_SECRET` | βœ… | Secret key for signing JWTs β€” use any long, random string (e.g., `openssl rand -hex 32`) | -| `CLIENT_ORIGIN` | ⬜ | *(Optional)* Allowed CORS origin for API requests. Set this to your production frontend URL (e.g., `https://dailyforge-frontend-lhjq.onrender.com`). If not set, it defaults to `http://localhost:5173` for local development. | +| Variable | Required | Description | +| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `PORT` | βœ… | Port on which the Express server runs (default: `5000`) | +| `MONGO_URI` | βœ… | Full MongoDB Atlas connection string β€” get it from your Atlas cluster's "Connect" menu | +| `JWT_SECRET` | βœ… | Secret key for signing JWTs β€” use any long, random string (e.g., `openssl rand -hex 32`) | +| `CLIENT_ORIGIN` | ⬜ | _(Optional)_ Allowed CORS origin for API requests. Set this to your production frontend URL (e.g., `https://dailyforge-frontend-lhjq.onrender.com`). If not set, it defaults to `http://localhost:5173` for local development. | **How to get `MONGO_URI`:** + 1. Log into [MongoDB Atlas](https://cloud.mongodb.com) 2. Create a free M0 cluster (if you haven't) 3. Click **Connect** β†’ **Connect your application** β†’ Copy the connection string @@ -289,20 +297,18 @@ JWT_SECRET=your_super_secret_key_here ### Frontend β€” `frontend/.env` -Copy the provided `.env.example` to a new file named `.env`. - +Copy the provided `.env.example` to a new file named `.env`. **Running locally?** Update `VITE_API_URL` in your local `.env` file to `http://localhost:5000/api/`. --- - - ## 🌐 Google Authentication Setup DailyForge supports Google Authentication via Firebase. Follow these steps to configure and enable Google Sign-In: ### 1. Firebase Console Setup + 1. Go to the [Firebase Console](https://console.firebase.google.com/) and click **Add project** to create a new project. 2. Once the project is created, click the **Web icon (``)** on the Project Overview page to register a new Web App. 3. Copy the `firebaseConfig` object containing the API key, app ID, etc. @@ -315,7 +321,9 @@ DailyForge supports Google Authentication via Firebase. Follow these steps to co To enable the frontend and backend integration, copy the configuration values into your respective `.env` files: #### Frontend β€” `frontend/.env` + Append your Firebase client configuration to your local `.env` file: + ```env # Firebase Client configuration VITE_FIREBASE_API_KEY=your_api_key @@ -327,7 +335,9 @@ VITE_FIREBASE_APP_ID=your_app_id ``` #### Backend β€” `backend/.env` + Add your Firebase Project ID to secure RS256 token verification: + ```env # Firebase verification configuration FIREBASE_PROJECT_ID=your_project_id @@ -335,6 +345,53 @@ FIREBASE_PROJECT_ID=your_project_id --- +## 🧩 REST API Reference + +**Base URL:** `/api` + +**JWT Authorization header:** + +```http +Authorization: Bearer +``` + +### Authentication + +| Method | Endpoint | Auth Required | Description | +| ------ | -------------------------- | ------------- | ---------------------------------- | +| POST | `/api/auth/signup` | No | Register a new user | +| POST | `/api/auth/login` | No | Login with email and password | +| POST | `/api/auth/google-login` | No | Login using Google authentication | +| GET | `/api/auth/user` | Yes | Get the current authenticated user | +| PUT | `/api/auth/update-profile` | Yes | Update the current user's profile | +| POST | `/api/auth/logout` | Yes | Log out the current user | + +### Tasks + +| Method | Endpoint | Auth Required | Description | +| ------ | ---------------- | ------------- | ---------------------------------------- | +| POST | `/api/tasks` | Yes | Create a new task | +| GET | `/api/tasks` | Yes | Get all tasks for the authenticated user | +| PUT | `/api/tasks/:id` | Yes | Update a task by ID | +| DELETE | `/api/tasks/:id` | Yes | Delete a task by ID | + +### Routines + +| Method | Endpoint | Auth Required | Description | +| ------ | ------------------- | ------------- | ------------------------------------------- | +| POST | `/api/routines` | Yes | Create a new routine | +| GET | `/api/routines` | Yes | Get all routines for the authenticated user | +| PUT | `/api/routines/:id` | Yes | Update a routine by ID | +| DELETE | `/api/routines/:id` | Yes | Delete a routine by ID | + +### Analytics + +| Method | Endpoint | Auth Required | Description | +| ------ | ---------------- | ------------- | --------------------------------------------------- | +| GET | `/api/analytics` | Yes | Get analytics/statistics for the authenticated user | + +--- + ## ❓ FAQ ### Why is the app slow on first load? @@ -347,8 +404,8 @@ The project is deployed on Render’s free tier. Services may go to sleep after Recommended versions: -* Node.js `v18+` -* npm `v9+` +- Node.js `v18+` +- npm `v9+` Check your installed versions: @@ -369,13 +426,13 @@ No. DailyForge uses MongoDB Atlas, so you only need a free Atlas account and a v Make sure: -* Backend CORS origin is set to: +- Backend CORS origin is set to: ```js -origin: "http://localhost:5173" +origin: "http://localhost:5173"; ``` -* Frontend `.env` contains: +- Frontend `.env` contains: ```env VITE_API_URL=http://localhost:5000/api @@ -396,21 +453,21 @@ Frontend variables go inside: ```bash /frontend/.env ``` + --- ## πŸ›  Troubleshooting -| Issue | Common Cause | Quick Fix | -| :--- | :--- | :--- | -| **CORS Errors** | `CLIENT_ORIGIN` or `FRONTEND_URL` mismatch in backend `.env`. | Ensure backend `.env` has correct origin (e.g., `http://localhost:5173`). Restart the server after changes. | -| **MongoDB Connection Error** | Incorrect `MONGO_URI`, wrong credentials, or IP not whitelisted. | Verify `MONGO_URI`, replace `` with correct DB password, and whitelist `0.0.0.0/0` in MongoDB Atlas Network Access. | -| **Frontend Cannot Connect to Backend** | Backend not running, wrong API URL, or port mismatch. | Set `VITE_API_URL=http://localhost:5000/api` and ensure backend is running on `http://localhost:5000`. | -| **JWT Authentication Errors** | Missing or incorrect `JWT_SECRET`. | Add `JWT_SECRET` in `backend/.env` and restart the backend server. | -| **Dependency Conflicts** | React 19 / Tailwind v4 strict peer dependency issues. | Run `npm install --legacy-peer-deps` in both frontend and backend directories. | -| **Glitchy Drag-and-Drop** | Browser extensions interfering with DOM events. | Test the app in **Incognito mode** or disable extensions. | -| **Port Already in Use** | Another process is using the same port. | Stop the running process or change `PORT` in `.env` (e.g., `PORT=5001`). | -| **Dependency Installation Issues** | Corrupted `node_modules` or lock file conflicts. | Run `rm -rf node_modules package-lock.json && npm install`. | - +| Issue | Common Cause | Quick Fix | +| :------------------------------------- | :--------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------- | +| **CORS Errors** | `CLIENT_ORIGIN` or `FRONTEND_URL` mismatch in backend `.env`. | Ensure backend `.env` has correct origin (e.g., `http://localhost:5173`). Restart the server after changes. | +| **MongoDB Connection Error** | Incorrect `MONGO_URI`, wrong credentials, or IP not whitelisted. | Verify `MONGO_URI`, replace `` with correct DB password, and whitelist `0.0.0.0/0` in MongoDB Atlas Network Access. | +| **Frontend Cannot Connect to Backend** | Backend not running, wrong API URL, or port mismatch. | Set `VITE_API_URL=http://localhost:5000/api` and ensure backend is running on `http://localhost:5000`. | +| **JWT Authentication Errors** | Missing or incorrect `JWT_SECRET`. | Add `JWT_SECRET` in `backend/.env` and restart the backend server. | +| **Dependency Conflicts** | React 19 / Tailwind v4 strict peer dependency issues. | Run `npm install --legacy-peer-deps` in both frontend and backend directories. | +| **Glitchy Drag-and-Drop** | Browser extensions interfering with DOM events. | Test the app in **Incognito mode** or disable extensions. | +| **Port Already in Use** | Another process is using the same port. | Stop the running process or change `PORT` in `.env` (e.g., `PORT=5001`). | +| **Dependency Installation Issues** | Corrupted `node_modules` or lock file conflicts. | Run `rm -rf node_modules package-lock.json && npm install`. | --- @@ -423,11 +480,13 @@ We love contributions! DailyForge is actively participating in **GSSoC 2026** an ### Quick Contribution Flow **1. Pick an issue** + - Browse [open issues](https://github.com/aryandas2911/DailyForge/issues) - Look for `good first issue` if you're new - Comment on the issue to get it assigned before starting work **2. Fork & branch** + ```bash git clone https://github.com//DailyForge.git cd DailyForge @@ -436,19 +495,21 @@ git checkout -b / **Branch naming convention:** -| Type | Example | -|------|---------| -| New feature | `feature/add-dark-mode` | -| Bug fix | `fix/login-redirect-loop` | -| Documentation | `docs/update-readme` | -| Refactor | `refactor/task-hook-cleanup` | +| Type | Example | +| ------------- | ---------------------------- | +| New feature | `feature/add-dark-mode` | +| Bug fix | `fix/login-redirect-loop` | +| Documentation | `docs/update-readme` | +| Refactor | `refactor/task-hook-cleanup` | **3. Make your changes** + - Keep changes focused β€” one issue per PR - Follow the existing code style - Test your changes locally before pushing **4. Open a Pull Request** + - Fill out the PR template completely - Link the issue it resolves using `Closes #` - Request a review from a maintainer @@ -461,16 +522,17 @@ git checkout -b / We use labels to organize work. Here's what they mean: -| Label | Meaning | -|-------|---------| +| Label | Meaning | +| ------------------ | -------------------------------------------------------------- | | `good first issue` | Small, well-scoped tasks β€” perfect for first-time contributors | -| `bug` | Something is broken or behaving incorrectly | -| `feature` | New functionality to be added | -| `documentation` | Improvements to README, guides, or inline comments | -| `help wanted` | Maintainers need external input or assistance | -| `testing` | Adding or improving test coverage | +| `bug` | Something is broken or behaving incorrectly | +| `feature` | New functionality to be added | +| `documentation` | Improvements to README, guides, or inline comments | +| `help wanted` | Maintainers need external input or assistance | +| `testing` | Adding or improving test coverage | **Tips for new contributors:** + - Start with `good first issue` β€” they're designed to be approachable - Don't hesitate to ask questions in the issue comments - One issue at a time β€” don't take on multiple issues until your first PR is merged @@ -480,15 +542,19 @@ We use labels to organize work. Here's what they mean: ## πŸ“Έ Screenshots ### πŸ” Signup Page + ![Signup Page](Screenshots/Signup.png) ### πŸ“Š Dashboard Overview + ![Dashboard](Screenshots/Dashboard.png) ### πŸ“‹ Tasks Page + ![Tasks Page](Screenshots/Tasks.png) ### πŸ—“οΈ Drag-and-Drop Routine Builder + ![Routine Builder](Screenshots/Routine.png) --- @@ -499,15 +565,15 @@ Need help with setup or contributing? ### You can: -* Open a GitHub Issue -* Comment on an existing issue for clarification -* Contact the maintainer through the email provided below +- Open a GitHub Issue +- Comment on an existing issue for clarification +- Contact the maintainer through the email provided below ### Before asking for help: -* Read the setup instructions carefully -* Check the FAQ and Troubleshooting sections -* Search existing GitHub issues first +- Read the setup instructions carefully +- Check the FAQ and Troubleshooting sections +- Search existing GitHub issues first We welcome contributors of all experience levels πŸš€ @@ -543,9 +609,9 @@ Thanks to all the amazing people who contribute to **DailyForge** πŸš€ Have questions, ideas, or want to connect with other contributors? -| Channel | Link | -|---------|------| -| πŸ“§ Email | aryandas2911@gmail.com | +| Channel | Link | +| --------- | ------------------------------------------------------------------ | +| πŸ“§ Email | aryandas2911@gmail.com | | πŸ› Issues | [GitHub Issues](https://github.com/aryandas2911/DailyForge/issues) | ---