A modern SaaS template built with the latest tools and frameworks:
- Next.js 14 for a robust and scalable React framework.
- Clerk for seamless user authentication and management.
- Drizzle ORM for type-safe and performant database operations.
- NeonDB as the database backend for your application.
- Webhook integration for handling external events in real time.
- Authentication: Secure and flexible user authentication powered by Clerk.
- Database: NeonDB with Drizzle ORM for structured and type-safe data handling.
- Next.js 14: Featuring server actions and other cutting-edge features for server and client integration.
- Webhooks: Easily configurable webhook support to listen to and process external events.
- Scalability: Designed with scalability and maintainability in mind, making it an excellent starting point for SaaS products.
Before setting up the project, ensure you have the following installed:
- Node.js (v18 or later)
- pnpm or npm or bun (bun is recommended)
- NeonDB account
- Clerk account
Follow these steps to set up and run the project locally:
# Clone the repository
git clone https://github.com/xonoxc/semplate.next.git
cd semplate.next
Install all required dependencies using pnpm
or npm
or bun
:
# Using pnpm
pnpm install
# OR using npm
npm install
# OR using bun
bun install
Create a .env
file in the root of the project and add the following variables:
# NeonDB Configuration
DATABASE_URL=postgresql://<username>:<password>@<host>/<database>
# Clerk Configuration
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=<your_clerk_frontend_api>
CLERK_SECRET_KEY=<your_clerk_api_key>
# Webhooks
WEBHOOK_SECRET=<your_webhook_secret>
Replace
<username>
,<password>
,<host>
,<database>
, and other placeholders with your actual configuration.
Run migrations using Drizzle ORM:
pnpm drizzle:sync
Ensure that the
DATABASE_URL
in.env
is correctly configured.
Start the development server:
pnpm dev
Visit http://localhost:3000 to view your application.
src/
├── app/ # Next.js application code (contain api and frontend)
├── components/ # UI components
├── db/ # db configuration
├── hooks/ # hooks
├── lib/ # Reusable libraries
├── types/ # type definitions
└── middleware.ts # application middleware
The application is optimized for deployment on platforms like Vercel.
-
Ensure environment variables are configured in your hosting platform.
-
Build the project:
pnpm build # or with bun bun build
-
Deploy to Vercel or spin up a vps (Vercel is recommended) .
To add a new webhook:
- Define a webhook handler in
src/app/api/webhooks/
. - Add the necessary secret keys and event configurations in a
.env
.
Contributions are welcome!.
follow the procedure for contributing:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License.