A modern, multi-tenant SaaS application for note-taking with role-based access control and subscription management.
SaaSNotes is a full-stack web application that provides a secure, scalable platform for organizations to manage their notes and documentation. Built with modern technologies, it offers a clean user interface and robust backend architecture.
- Multi-tenant Architecture: Isolated data and user management per organization
- Role-based Access Control: Admin and user roles with different permissions
- Subscription Management: Free and Pro plans with different note limits
- Modern UI: Clean, responsive interface built with Next.js and Tailwind CSS
- Secure Authentication: JWT-based authentication with bcrypt password hashing
- Database Management: PostgreSQL with Prisma ORM for type-safe database operations
- RESTful API: Well-structured backend API with proper error handling
- Next.js 13 - React framework with App Router
- TypeScript - Type-safe JavaScript
- Tailwind CSS - Utility-first CSS framework
- Radix UI - Accessible component library
- Lucide React - Icon library
- Node.js - JavaScript runtime
- Express.js - Web framework
- Prisma - Database ORM
- PostgreSQL - Relational database
- JWT - Authentication tokens
- bcryptjs - Password hashing
SaaSNotes/
├── client/ # Next.js frontend application
│ ├── app/ # App Router pages
│ ├── components/ # Reusable React components
│ ├── contexts/ # React context providers
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utility functions and API client
│ └── types/ # TypeScript type definitions
├── server/ # Express.js backend application
│ ├── src/
│ │ ├── middleware/ # Express middleware
│ │ ├── routes/ # API route handlers
│ │ └── scripts/ # Database seeding scripts
│ └── prisma/ # Database schema and migrations
└── README.md # This file
- Node.js (v18 or higher)
- PostgreSQL database
- npm or yarn package manager
-
Clone the repository
git clone https://github.com/jsndz/SaaSNotes cd SaaSNotes -
Install dependencies
# Install frontend dependencies cd client npm install # Install backend dependencies cd ../server npm install
-
Set up environment variables
Create a
.envfile in theserverdirectory:DATABASE_URL="postgresql://username:password@localhost:5432/database_name" JWT_SECRET="your-jwt-secret-key" PORT=3001
-
Set up the database
cd server npm run db:migrate npm run db:seed -
Start the development servers
Backend (Terminal 1):
cd server npm startFrontend (Terminal 2):
cd client npm run dev -
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
POST /api/auth/login- User loginPOST /api/auth/register- User registrationPOST /api/auth/logout- User logout
GET /api/notes- Get all notes for tenantPOST /api/notes- Create a new noteGET /api/notes/:id- Get specific notePUT /api/notes/:id- Update noteDELETE /api/notes/:id- Delete note
GET /api/tenants- Get tenant informationPUT /api/tenants- Update tenant settings
The application uses a multi-tenant architecture with the following main entities:
- Users: User accounts with email, password, and role
- Tenants: Organizations with subscription plans and note limits
- Notes: Individual notes belonging to tenants
- UserTenants: Junction table for user-tenant relationships
Frontend (client/):
npm run dev- Start development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLint
Backend (server/):
npm start- Start production servernpm run dev- Start development server with nodemonnpm run db:migrate- Run database migrationsnpm run db:seed- Seed database with sample datanpm run db:studio- Open Prisma Studionpm run db:generate- Generate Prisma client
The application uses Prisma for database management. Key commands:
# Create a new migration
npx prisma migrate dev --name migration_name
# Reset the database
npx prisma migrate reset
# View database in Prisma Studio
npx prisma studio- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions, please open an issue in the repository or contact the development team.