https://github.com/ezeparziale/nextjs-api-template
:rocket: Next.js API Template
https://github.com/ezeparziale/nextjs-api-template
nextjs prisma swagger zod zod-openapi
Last synced: about 2 months ago
JSON representation
:rocket: Next.js API Template
- Host: GitHub
- URL: https://github.com/ezeparziale/nextjs-api-template
- Owner: ezeparziale
- Created: 2024-07-31T21:07:44.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-07T18:43:51.000Z (over 1 year ago)
- Last Synced: 2025-03-14T00:13:17.253Z (11 months ago)
- Topics: nextjs, prisma, swagger, zod, zod-openapi
- Language: TypeScript
- Homepage: https://nextjs-api-template.vercel.app
- Size: 257 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# :rocket: Next.js API Template
A boilerplate template for building APIs with Next.js, featuring schema validation and
OpenAPI documentation.
- [x] API with basic operations: POST/GET/PUT/PATCH/DELETE
- [x] OpenAPI schema
- [x] Validation of request bodies with Zod
- [x] Validation of query parameters with Zod
- [x] OpenAPI schema generation with `zod-openapi`
- [x] Swagger docs
- [x] Token-based authorization
## :floppy_disk: Installation
1. Clone this repo:
```http
git clone https://github.com/ezeparziale/nextjs-api-template.git
```
2. Navigate to the project directory:
```bash
cd nextjs-api-template
```
3. Install dependencies:
```bash
npm i
```
4. Create a `.env` file by copying the `.env.template` file and updating it with your
environment variables.
5. Run migrations to initialize the database:
```bash
npx prisma migrate deploy
```
6. Start the application:
```bash
npm run dev
```
7. Go to:
```http
http://localhost:3000
```
## :page_facing_up: API Docs
```http
http://localhost:3000/api/openapi
```
```http
http://localhost:3000/api/docs
```