This repository provides a comprehensive monorepo architecture integrating modern, production-ready technologies for accelerated web development. The stack includes:
- Next.js — Application frontend and dashboard
- Fastify — High-performance REST API backend
- Astro — Static marketing website
Out of the box, this template incorporates user authentication (including credential-based login, OAuth2, two-factor authentication, and passkeys), a PostgreSQL database managed via Drizzle ORM, and a suite of supporting utilities for analytics, observability, and security.
- Features
- Tech Stack
- Applications
- Packages
- Deployment
- Environment Variables
- Screenshots
- FAQ
- Contributing
- Support
- Appendix
- Authors
- Light and dark mode toggle for improved accessibility and user preference
- Live preview functionality for dynamic content updates
- Fullscreen mode for distraction-free usage
- Cross-platform compatibility (works seamlessly on Windows, macOS, and Linux)
- Built-in authentication (credential login, OAuth2, two-factor authentication, passkeys)
- PostgreSQL database integration with Drizzle ORM
- Modular monorepo structure: Next.js app, Fastify API, Astro marketing site, Drizzle Studio
- Customizable design system with shadcn/ui and Tailwind CSS
- Analytics integration (PostHog, Vercel Analytics, Google Analytics)
- Email support using React Email and Resend
- Observability tools (Logtail, Sentry) for monitoring and error tracking
- API rate-limiting powered by Upstash
- Comprehensive SEO configuration
- Easy deployment to Vercel (frontend and marketing) and Render (backend)
Frontend:
- Next.js (React)
- Tailwind CSS
- shadcn/ui
- Redux (if applicable)
Backend:
- Fastify (Node.js)
- Drizzle ORM
- PostgreSQL
Marketing Site:
- Astro
Shared & Utilities:
- TypeScript
- ESLint
- React Email & Resend (email)
- PostHog, Vercel Analytics, Google Analytics (analytics)
- Sentry, Logtail (observability)
- Upstash (API rate limiting)
- Arcjet (security)
- app: Next.js dashboard application.
- backend: Fastify REST API server.
- studio: Drizzle ORM Studio for database management.
- web: Static marketing site built with Astro.
- analytics: Unified analytics solution utilizing PostHog, Vercel Analytics, and Google Analytics.
- database: PostgreSQL integration powered by Drizzle ORM.
- design system: Centralized UI library leveraging shadcn/ui and Tailwind CSS.
- email: Email functionality via React Email and Resend.
- observability: Logging and error tracking using Logtail and Sentry.
- ratelimit: API rate limiting implemented with Upstash.
- security: Advanced security mechanisms provided by Arcjet.
- seo: Shared configuration for search engine optimization.
- eslint-config: Standardized ESLint configuration.
- next-config: Centralized Next.js configuration for all modules and packages.
- typescript-config: Shared TypeScript configuration to enforce code quality and consistency.
Follow these steps to set up the project locally:
-
Clone the repository
git clone https://github.com/devchaudhary24k/nextjs-fastify-turborepo.git cd nextjs-fastify-turborepo -
Install dependencies
pnpm install
-
Set up environment variables
Copy the environment template and update the configuration for each application:cp .env.example .env
Repeat this step for every app within the monorepo. Edit the
.envfiles with the required values. -
Start local services (Database & Redis)
Make sure Docker is running, then launch the database and cache services:docker-compose up -d
-
Push the database schema
pnpm run db:push
-
Start the development servers
pnpm run dev
The recommended deployment strategy for this monorepo is as follows:
- Next.js Application (
app): Deploy to Vercel, which offers seamless integration and optimized hosting for Next.js apps. - Astro Marketing Site (
web): Deploy to Vercel for best static site performance and simple CI/CD from your GitHub repository. - Fastify Backend (
backend): Deploy to Render for fast, reliable Node.js API hosting with automatic deployments from your repository.
All of these platforms support direct integration with GitHub, enabling continuous deployment on every push to your main branch.
Docker support is currently in progress and will be provided soon.
Each application in this monorepo requires its own set of environment variables.
Create a .env file in the root directory of each app, and add the necessary variables as shown below:
NEXT_PUBLIC_API_URLNEXTAUTH_SECRETNEXTAUTH_URL- (Add other required variables here)
DATABASE_URLJWT_SECRETAPI_PORT- (Add other required variables here)
DATABASE_URL- (Add other required variables here)
PUBLIC_BACKEND_URLSITE_URL- (Add other required variables here)
Refer to the
.env.examplefile in each directory for a full list and descriptions of the required environment variables.
Screenshots will be updated soon, we are working on it.
To add your own screenshots, upload image files to the repository (e.g., in a
/screenshotsor/docsdirectory) and update the image URLs in this section.
Yes! This project is licensed under the MIT License, which permits use in both personal and commercial projects.
The recommended approach is to deploy the Next.js app and the Astro site to Vercel, and the Fastify backend to Render. See the Deployment section for details.
This template uses PostgreSQL by default, managed via Drizzle ORM.
Each app in the monorepo has its own .env file. Copy the .env.example to .env in each directory and fill in the necessary values. See Environment Variables for more information.
Docker support is currently in progress and will be available soon.
Please open an issue on the GitHub repository.
Yes. The template supports credential-based login, OAuth2, two-factor authentication (TFA), and passkey authentication out of the box.
Absolutely! Contributions are welcome. Please read the CONTRIBUTING.md for guidelines.
Don’t see your question here? Open an issue or reach out via the project discussions!
Contributions are always welcome! If you’d like to get involved, please follow these steps:
- Read the CONTRIBUTING.md for detailed guidelines and instructions on how to get started.
- Please make sure to adhere to our Code of Conduct to foster a welcoming and respectful community.
We look forward to your ideas, bug reports, and pull requests!
If you need help or have questions, please reach out to us:
- 📧 Email: support@devtalan.com
- 💬 Join our Discord community for real-time assistance and discussion.
You can also open an issue on the GitHub repository for bug reports and feature requests.
- Fastify: A web framework for Node.js.
- Passkeys: A passwordless authentication method.