A template for Express.js backend applications with Prisma ORM and session-based authentication.
- Express.js
- Prisma ORM with PostgreSQL
- Session-based authentication using Passport.js
- CORS enabled for frontend integration
- ESLint and Prettier configuration
- Jest testing setup
- Environment configuration
- Node.js (v18 or higher)
- PostgreSQL database server
- npm or yarn
Before installation, make sure to:
- Create a PostgreSQL database for development
- Create a separate PostgreSQL database for testing
- Note down your database credentials for the
.envfile
# Clone the repository
git clone [email protected]:goran1010/template-express-prisma-backend-session.git
# Navigate to project directory
cd template-express-prisma-backend-session
# Install dependencies
npm install
# Setup environment variables
cp .env.example .env
# Edit .env with your database credentials and secret
# Initialize database and run migrations
npx prisma migrate dev# Start development server with hot reload
npm run dev
# Start production server
npm run start
# Run tests
npm run testDATABASE_URL: PostgreSQL URL for development databaseTEST_DATABASE_URL: PostgreSQL URL for test databaseSECRET: Session secret keyPORT: Server port (defaults to 3000)
MIT