https://github.com/kaykeeb3/login-backend
This is the backend of a login screen project, an example application for managing user authentication.
https://github.com/kaykeeb3/login-backend
docker express jest jwt nodejs postgresql prisma
Last synced: 4 months ago
JSON representation
This is the backend of a login screen project, an example application for managing user authentication.
- Host: GitHub
- URL: https://github.com/kaykeeb3/login-backend
- Owner: kaykeeb3
- Created: 2024-02-01T17:24:37.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-27T11:25:36.000Z (over 1 year ago)
- Last Synced: 2025-05-07T01:42:49.563Z (about 1 year ago)
- Topics: docker, express, jest, jwt, nodejs, postgresql, prisma
- Language: JavaScript
- Homepage:
- Size: 56.6 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Login - Backend
This is the backend of a login screen project, an example application for managing user authentication. The project is built with **Node.js**, **Express.js**, **Jest**, **Prisma**, **PostgreSQL**, and uses **JWT** for authentication.
## Getting Started
Before starting, make sure you have **Docker** and **Docker Compose** installed on your system.
### 1. Clone the Repository
```bash
git clone https://github.com/kaykeeb3/login-backend.git
cd login-backend
npm install
```
### 2. Create a `.env` File
Create a `.env` file at the root of the project with the following environment variables:
```bash
DATABASE_URL=postgresql://user:password@localhost:5432/login_db
JWT_SECRET=
```
### 3. Start Docker Compose
```bash
docker-compose up -d
```
### 4. Install Dependencies and Run Migrations
```bash
npm install
npx prisma migrate dev
```
### 5. Start the Server
```bash
npm start
```
## Folder & File Structure
The project follows the structure below:
```
|-- src
| |-- controllers
| | |-- authController.js
| | |-- userController.js
| |-- middlewares
| | |-- authenticationMiddleware.js
| |-- routes
| | |-- authRoutes.js
| | |-- userRoutes.js
| |-- services
| | |-- authService.js
| | |-- userService.js
| |-- utils
| | |-- jwtUtils.js
| |-- app.js
| |-- db.js
|-- .env
|-- .gitignore
|-- package.json
|-- prisma
| |-- schema.prisma
|-- tests
| |-- authService.test.js
| |-- authController.test.js
| |-- userController.test.js
|-- docker-compose.yml
|-- README.md
```