This project is a complete Next.js boilerplate designed to accelerate the development of modern web applications. It includes:
- Next.js with TypeScript and Tailwind CSS
- PostgreSQL as a database with Drizzle ORM
- Authentication (Email/Password & OAuth)
- Internationalization (i18n)
- A dashboard
- A component library
- Docker & Docker Compose for easy service management
- Frontend & API Rest: Next.js, TypeScript, Tailwind CSS
- Database: PostgreSQL with Adminer for administration
- Image Server: Minio
- Deployment: Docker & Docker Compose
📂 saas-boilerplate/
├── 📂 next-app/ # Next.js application
│ ├── 📂 public/ # Static assets
│ ├── 📂 src/
│ │ ├── 📂 app/ # Next.js app directory
│ │ ├── 📂 components/ # UI components (atoms, molecules, organisms, templates)
│ │ │ ├── 📂 atoms/ # Atomic design pattern - smallest components, includes shadcn/ui
│ │ │ ├── 📂 molecules/ # Small combinations of atoms
│ │ │ ├── 📂 organisms/ # Larger components made of molecules
│ │ │ ├── 📂 templates/ # Page templates
│ │ ├── 📂 config/ # Configuration files (Drizzle ORM, i18n, Minio, etc.)
│ │ ├── 📂 hooks/ # Custom React hooks
│ │ ├── 📂 locales/ # i18n translations
│ │ ├── 📂 models/ # Database models (Drizzle ORM)
│ │ ├── 📂 services/ # Business logic and API services
│ │ ├── 📂 utils/ # Utility functions (authentication, validation, helpers)
│ │ ├── 📚 middleware.ts # Middleware configuration (authentication, etc.)
├── 📄 docker-compose.yml # Docker configuration
└── 📄 README.md # Project documentation
Make sure you have installed:
Clone the repository and start the services:
git clone https://github.com/your-repo/my-project.git
cd my-project
docker-compose up --buildYour application will be accessible at:
- Frontend:
http://localhost:3000 - Rest API:
http://localhost:3000/api - Postgres Admin:
http://localhost:8080 - Minio interface:
http://localhost:9001 - Minio API:
http://localhost:9000
Create a .env file and add the necessary variables:
## DATABASE
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_DB=mydatabase
## NEXT
GOOGLE_CLIENT_ID= // TO COMPLETE
GOOGLE_REDIRECT_URI=http://localhost:3000/api/auth/callback/google
GOOGLE_CLIENT_SECRET= // TO COMPLETE
NEXTAUTH_SECRET= // TO COMPLETE
## MINIO
MINIO_ROOT_USER=admin
MINIO_ROOT_PASSWORD=password
- Secure authentication with Email/Password & OAuth
- Internationalization with
next-international - Dashboard with user management
- Component library for a consistent UI (shadcn/ui)
- Drizzle ORM for database management
This boilerplate follows a modular architecture, ensuring scalability and maintainability:
-
Separation of concerns:
- UI components follow the Atomic Design Pattern, with components structured into
atoms,molecules,organisms, andtemplates. - Shadcn/UI components are integrated directly in
atoms/to ensure consistency and reusability. - API and business logic are handled in
services/. - Database models are defined in
models/.
- UI components follow the Atomic Design Pattern, with components structured into
-
Scalable authentication:
- Uses OAuth and email/password authentication.
- JWT tokens are managed in
utils/jwt.ts.
-
Internationalization (i18n):
- Implemented with
next-international, with translations stored inlocales/.
- Implemented with
-
Database & ORM:
- Drizzle ORM for database interactions, configured in
config/drizzle.config.ts. - Tables are defined in
models/.
- Drizzle ORM for database interactions, configured in
-
File storage with Minio:
- Minio is used as an object storage service for file uploads, configured in
config/minio.config.ts.
- Minio is used as an object storage service for file uploads, configured in
-
Middleware & Utils:
- Custom middleware for authentication (
middleware.ts). - Utility functions in
utils/for hashing, validation, and actions.
- Custom middleware for authentication (
docker-compose up -d
## or
make updocker-compose down
## or
make downmake