GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - leedontbeshy/node-express-prisma-boilerplate

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
.husky
.husky
 
 
docs
docs
 
 
prisma
prisma
 
 
src
src
 
 
.env.example
.env.example
 
 
.gitignore
.gitignore
 
 
.prettierignore
.prettierignore
 
 
.prettierrc
.prettierrc
 
 
README.md
README.md
 
 
eslint.config.mjs
eslint.config.mjs
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

Node.js Express TypeScript Prisma Boilerplate


Features

  • Express.js - Fast, unopinionated web framework
  • TypeScript - Type safety and modern JavaScript features
  • Prisma ORM - Modern database toolkit
  • Layered Architecture - Clean separation of concerns (Controllers, Services, Repositories)
  • Middleware Support - Authentication, validation, error handling
  • Environment Variables - Configuration management with dotenv
  • Code Quality - ESLint, Prettier, Husky pre-commit hooks
  • Security - Helmet, CORS, rate limiting
  • Logging - Morgan HTTP request logger

Project Structure

src/
├── app.ts              # Express app configuration
├── server.ts           # Server entry point
├── common/             # Shared constants, enums, responses
├── config/             # Configuration files (database, env)
├── controllers/        # Request handlers
├── middlewares/        # Custom middleware (auth, validation, error)
├── repositories/       # Database access layer
├── routes/             # API route definitions
├── services/           # Business logic layer
├── types/              # TypeScript type definitions
└── utils/              # Helper functions

Installation

  1. Clone the repository
git clone <your-repo-url>
cd <your-prj>
  1. Install dependencies
npm install
  1. Setup environment variables
# Create .env file
cp .env.example .env

# Edit .env with your configuration
DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
PORT=3000
NODE_ENV=development
  1. Setup Prisma
# Generate Prisma Client
npm run db:generate

# Run migrations
npm run db:migrate

# (Optional) Open Prisma Studio
npm run db:studio

Usage

Development mode

npm run dev

Build for production

npm run build
npm start

Linting and formatting

npm run lint
npm run lint:fix
npm run format

Example API Structure

This boilerplate includes a simple User API example:

Endpoints:

  • GET /api/users - Get all users
  • GET /api/users/:id - Get user by ID
  • POST /api/users - Create new user
  • PUT /api/users/:id - Update user
  • DELETE /api/users/:id - Delete user

Architecture Flow:

Request → Route → Middleware → Controller → Service → Repository → Database
                                                 ↓
Response ← Controller ← Service ← Repository ← Database

Adding New Features

  1. Define types in src/types/
  2. Create repository in src/repositories/ for database operations
  3. Create service in src/services/ for business logic
  4. Create controller in src/controllers/ for request handling
  5. Define routes in src/routes/
  6. Add middleware if needed in src/middlewares/
  7. Register routes in src/app.ts

Technologies

  • Node.js v18+
  • Express.js v5
  • TypeScript v5
  • Prisma ORM v5
  • Zod (Validation)
  • JWT (Authentication)
  • Helmet (Security)
  • Morgan (Logging)

**Happy Coding! **

About

No description, website, or topics provided.

Resources

Readme
Activity

Stars

4 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.