Skip to content

Latest commit

 

History

99 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Node.js Express.js React Tailwind CSS TypeScript PostgreSQL JWT

Users API

A full-stack user authentication project built with Node.js, Express, React, PostgreSQL, and JWT.

Overview

This project allows users to:

  • register an account
  • log in securely
  • authenticate protected routes with JWT
  • manage profile data through a dedicated frontend app

It is a study project focused on backend auth flows, PostgreSQL integration, and frontend interaction with a REST API.

Prerequisites

Before starting, make sure you have:

  • Node.js 18+
  • npm
  • PostgreSQL running locally or in a container
  • A database created for the app

Project structure

usersapi/
├── backend/
│   ├── .env.example
│   ├── src/
│   ├── package.json
│   └── ...
├── frontend/
│   ├── app/
│   ├── package.json
│   └── ...
├── README.md
└── .gitignore

Backend setup

  1. Open a terminal in the backend folder.
  2. Install dependencies:
npm install
  1. Create a .env file in backend/ based on .env.example:
cp .env.example .env
  1. Update the values in .env with your PostgreSQL and JWT credentials:
PORT=3000
DB_USER=your_database_user
DB_PASSWORD=your_database_password
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=userapi
ACCESS_TOKEN_SECRET=your_access_token_secret
REFRESH_TOKEN_SECRET=your_refresh_token_secret
  1. Create the database and the required table. The SQL structure is available in backend/src/config/schema.sql.

  2. Start the backend server:

npm run dev

By default, the backend runs on:

Frontend setup

  1. Open a terminal in the frontend folder.
  2. Install dependencies:
npm install
  1. Start the frontend app:
npm run dev

By default, the frontend runs on:

Running the app

To use the full application, both services must be running at the same time:

  • PostgreSQL database
  • backend API
  • frontend app

Default ports

  • Backend: 3000
  • Frontend: 5173
  • PostgreSQL: 5432

Notes

  • The backend uses CORS configured for http://localhost:5173.
  • JWT secrets should be long and unique in production.
  • The project is intentionally designed as a learning-focused application and is meant to evolve over time.

About

REST API made to manage users in the database with password hashing and user authentication.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages