Skip to content

techkeshav23/notes-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Notes App

A full-stack notes application with separate frontend and backend architecture, featuring OTP-based authentication and CRUD operations for notes.

πŸš€ Technologies Used

Frontend

  • React 18 - UI Library
  • TypeScript - Type safety
  • Vite - Build tool and development server
  • React Router DOM - Client-side routing
  • TailwindCSS - Utility-first CSS framework
  • Radix UI - Headless UI components
  • Lucide React - Icon library
  • React Hook Form - Form handling
  • Zod - Schema validation

Backend

  • Express.js - Web framework
  • MongoDB/Mongoose - Database
  • JWT - Authentication
  • Nodemailer - Email service
  • bcryptjs - Password hashing
  • CORS - Cross-origin resource sharing

πŸ“ Project Structure

β”œβ”€β”€ backend/              # Backend API server
β”‚   β”œβ”€β”€ middleware/       # Express middleware
β”‚   β”œβ”€β”€ models/          # MongoDB models
β”‚   β”œβ”€β”€ .env.example     # Environment variables template
β”‚   β”œβ”€β”€ package.json     # Backend dependencies
β”‚   β”œβ”€β”€ server.js        # Main server file
β”‚   └── README.md        # Backend documentation
β”œβ”€β”€ frontend/            # Frontend React app
β”‚   β”œβ”€β”€ src/            # React source code
β”‚   β”‚   β”œβ”€β”€ components/ # Reusable UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ auth/  # Authentication components
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard/ # Dashboard components
β”‚   β”‚   β”‚   └── ui/    # Base UI components
β”‚   β”‚   β”œβ”€β”€ hooks/     # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ lib/       # Utility functions
β”‚   β”‚   β”œβ”€β”€ pages/     # Page components
β”‚   β”‚   β”œβ”€β”€ App.tsx    # Main app component
β”‚   β”‚   └── main.tsx   # Entry point
β”‚   β”œβ”€β”€ public/        # Static assets
β”‚   β”œβ”€β”€ .env           # Frontend environment variables
β”‚   β”œβ”€β”€ package.json   # Frontend dependencies
β”‚   └── README.md      # Frontend documentation
β”œβ”€β”€ start-dev.bat      # Windows batch startup script
β”œβ”€β”€ start-dev.ps1      # PowerShell startup script
└── README.md          # This file

πŸ› οΈ Setup and Installation

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB (local or MongoDB Atlas)
  • SMTP email service (for OTP delivery)

Backend Setup

  1. Navigate to backend directory:

    cd backend
  2. Install backend dependencies:

    npm install
  3. Create environment file:

    cp .env.example .env
  4. Configure your .env file with:

    • MongoDB connection string
    • SMTP email settings
    • JWT secret
    • Other configurations
  5. Start backend development server:

    npm run dev

Frontend Setup

  1. Navigate to frontend directory:

    cd frontend
  2. Install frontend dependencies:

    npm install
  3. Configure environment variables: The .env file should already contain:

    VITE_BASE_URL=http://localhost:3001/api
  4. Start frontend development server:

    npm run dev

πŸš€ Running the Application

  1. Start the backend server:

    cd backend && npm run dev

    Backend will run on: http://localhost:3001

  2. Start the frontend server (in another terminal):

    cd frontend && npm run dev

    Frontend will run on: http://localhost:5173

πŸ“± Features

Authentication

  • OTP-based signup and signin
  • JWT token authentication
  • Email verification
  • Protected routes

Notes Management

  • Create, read, update, delete notes
  • Tag notes for organization
  • Mark notes as important
  • Search and filter functionality

User Interface

  • Responsive design
  • Modern UI with Radix components
  • Toast notifications
  • Loading states
  • Error handling

🌐 Available Routes

Frontend Routes

  • / - Dashboard (protected)
  • /signin - User sign in page
  • /signup - User sign up page

Backend API Endpoints

  • POST /api/send-signup-otp - Send signup OTP
  • POST /api/send-signin-otp - Send signin OTP
  • POST /api/verify-signup-otp - Verify signup OTP
  • POST /api/verify-signin-otp - Verify signin OTP
  • GET /api/notes - Get user notes (protected)
  • POST /api/notes - Create note (protected)
  • PUT /api/notes/:id - Update note (protected)
  • DELETE /api/notes/:id - Delete note (protected)

πŸ”§ Environment Variables

Frontend (frontend/.env)

VITE_BASE_URL=http://localhost:3001/api

Backend (backend/.env)

MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
SMTP_HOST=your_smtp_host
SMTP_PORT=your_smtp_port
SMTP_USER=your_email
SMTP_PASS=your_email_password
ADMIN_EMAIL=your_admin_email
APP_NAME=Notes App
PORT=3001

πŸš€ Production Deployment

Frontend

cd frontend
npm run build
npm run preview

Backend

cd backend
npm start

For Hosting

  • Backend: Deploy the backend/ folder to your server (Heroku, Railway, etc.)
  • Frontend: Deploy the frontend/ folder to a static hosting service (Vercel, Netlify, etc.)
  • Update the VITE_BASE_URL in frontend .env to point to your production backend URL

🎯 Next Steps

  • Add unit tests for both frontend and backend
  • Implement note sharing functionality
  • Add file attachments to notes
  • Implement real-time synchronization
  • Add mobile app with React Native
  • Set up CI/CD pipeline
  • Add Docker containerization

Happy coding! πŸŽ‰

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors