Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/henchoznoe/expressauthtemplate
Basic authentication template using Node.js, Express.js, TypeScript, Prisma and a PostgreSQL database.
https://github.com/henchoznoe/expressauthtemplate
expressjs jwt nodejs postresql prisma typescript
Last synced: 22 days ago
JSON representation
Basic authentication template using Node.js, Express.js, TypeScript, Prisma and a PostgreSQL database.
- Host: GitHub
- URL: https://github.com/henchoznoe/expressauthtemplate
- Owner: henchoznoe
- Created: 2024-06-18T14:48:22.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-09-10T17:43:09.000Z (4 months ago)
- Last Synced: 2024-09-10T19:54:25.138Z (4 months ago)
- Topics: expressjs, jwt, nodejs, postresql, prisma, typescript
- Language: TypeScript
- Homepage: https://express-auth-template.vercel.app
- Size: 196 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node.js and Express.js Authentication Template
## Description
This project is a template for setting up authentication in a Node.js application using Express.js, TypeScript, Prisma and PostgreSQL.## Prerequisites
- Node.js
- PostgreSQL database## Installation Steps
### 1. Clone the Repository
### 2. Install Dependencies
Install the necessary dependencies by running:
```bash
npm install
```### 3. Configure Environment Variables
Rename the `.env.example` file to `.env` and update the environment variables accordingly.### 4. Prisma Setup
Run the following command to push the Prisma schema to your database:
```bash
npx prisma db push
```
If you need to apply migrations (recommended for production setups), use:
```bash
npx prisma migrate dev --name init
```### 5. Add roles in the database and edit the enum in `src/types/auth.ts` if needed
Run the following command in your database:
```sql
INSERT INTO "Role" VALUES (1, 'SuperAdmin'), (2, 'Admin'), (3, 'User');
```### 6. Run the Development Server
Start the development server with:
```bash
npm run dev
```## Usage
* Open http://localhost:5000/api-docs to view the documentation provided by Swagger UI.