An open API service indexing awesome lists of open source software.

https://github.com/top-submissions/template-react-expressjs


https://github.com/top-submissions/template-react-expressjs

authentication crud css-modules express fullstack javascript jwt nodejs postgresql prisma react react-router rest-api role-based-access-control template testing the-odin-project typescript-ready vite vitest

Last synced: 17 days ago
JSON representation

Awesome Lists containing this project

README

          

# Project Name

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![The Odin Project](https://img.shields.io/badge/The%20Odin%20Project-NodeJS-red)](https://www.theodinproject.com/paths/full-stack-javascript/courses/nodejs)

> A full-stack application built with React and Express as part of The Odin Project's NodeJS curriculum. Features JWT authentication, role-based access control, PostgreSQL via Prisma ORM, and a modular search system.

## ๐Ÿ“‹ Table of Contents

- [Project Name](#project-name)
- [๐Ÿ“‹ Table of Contents](#-table-of-contents)
- [โœจ Features](#-features)
- [๐Ÿš€ Getting Started](#-getting-started)
- [๐Ÿ“ Project Structure](#-project-structure)
- [๐Ÿ“– Documentation](#-documentation)
- [๐Ÿงช Testing](#-testing)
- [๐Ÿ’ก Future Improvements](#-future-improvements)
- [๐Ÿ› ๏ธ Technologies Used](#๏ธ-technologies-used)
- [๐Ÿ™ Acknowledgments](#-acknowledgments)

## โœจ Features

- JWT authentication with HttpOnly cookies
- Role-based access control (USER / ADMIN / SUPER_ADMIN)
- Full-stack search with filters, sorting, and URL-state persistence
- Prisma ORM with PostgreSQL
- Vitest + React Testing Library test suite (client & server)
- Dark/light theme toggle
- Responsive layout with mobile Navbar

## ๐Ÿš€ Getting Started

See **[docs/setup.md](docs/setup.md)** for the full environment setup guide.

**Quick start** (after setup):

```bash
npm run install:all # install all dependencies
npm run dev # start client + server concurrently
```

## ๐Ÿ“ Project Structure

```
template-react-expressjs/
โ”œโ”€โ”€ client/ # React + Vite frontend
โ”‚ โ””โ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ components/ # UI components grouped by domain
โ”‚ โ”œโ”€โ”€ config/ # searchConfig.js โ€” drives all search UI
โ”‚ โ”œโ”€โ”€ layouts/ # MainLayout (Navbar + Outlet)
โ”‚ โ”œโ”€โ”€ modules/api/ # Fetch wrappers per domain
โ”‚ โ”œโ”€โ”€ pages/ # Route-level components
โ”‚ โ”œโ”€โ”€ providers/ # Auth, Theme, Toast context
โ”‚ โ”œโ”€โ”€ routes/ # AuthRoute, AdminRoute guards
โ”‚ โ”œโ”€โ”€ routes.jsx # createBrowserRouter config
โ”‚ โ””โ”€โ”€ styles/ # Global CSS variables, reset, animations
โ”œโ”€โ”€ server/ # Express backend
โ”‚ โ””โ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ config/ # Passport, CORS, cookie options
โ”‚ โ”œโ”€โ”€ controllers/ # Route handlers
โ”‚ โ”œโ”€โ”€ db/queries/ # Prisma query functions per domain
โ”‚ โ”œโ”€โ”€ middleware/ # Auth, error, app middleware
โ”‚ โ””โ”€โ”€ routes/ # Express routers
โ”œโ”€โ”€ docs/
โ”‚ โ”œโ”€โ”€ setup.md # Environment setup (PostgreSQL, .env, pgAdmin)
โ”‚ โ”œโ”€โ”€ architecture.md # Stack overview, request flow, patterns
โ”‚ โ””โ”€โ”€ testing.md # Testing conventions and patterns
โ”œโ”€โ”€ CONTRIBUTING.md # Branching, commit conventions, PR process
โ”œโ”€โ”€ CHANGELOG.md # Version history
โ””โ”€โ”€ package.json # Root orchestration scripts
```

## ๐Ÿ“– Documentation

| Doc | Description |
| -------------------------------------------- | ----------------------------------------------------------------------- |
| [docs/setup.md](docs/setup.md) | PostgreSQL installation (Windows/macOS/Linux), `.env` config, pgAdmin 4 |
| [docs/architecture.md](docs/architecture.md) | Stack overview, request flow, client/server structure, auth flow |
| [docs/testing.md](docs/testing.md) | Testing patterns, mocking conventions, what to test |
| [CONTRIBUTING.md](CONTRIBUTING.md) | Branching strategy, commit conventions, PR process |
| [CHANGELOG.md](CHANGELOG.md) | Version history |

## ๐Ÿงช Testing

```bash
cd client && npm run test:watch # client โ€” watch mode
cd server && npm run test:watch # server โ€” watch mode
```

See [docs/testing.md](docs/testing.md) for patterns, mocking conventions, and gotchas.

## ๐Ÿ’ก Future Improvements

- [ ] Gallery and list view modes for search results
- [ ] Pagination on search results
- [ ] Email verification on signup
- [ ] File upload support (profile avatars)
- [ ] Rate limiting on auth endpoints

## ๐Ÿ› ๏ธ Technologies Used

**Client:** React 19, React Router 7, Vite, CSS Modules, Lucide React, Vitest, React Testing Library

**Server:** Node.js, Express, Prisma ORM, PostgreSQL, Passport.js (Local + JWT), bcryptjs, express-validator

**Tooling:** ESLint, Prettier, concurrently, nodemon

## ๐Ÿ™ Acknowledgments

- **The Odin Project** โ€” For providing an amazing free curriculum
- **The TOP Community** โ€” For being supportive and helpful throughout

---

Built with ๐Ÿ’ก and โ˜• as part of my journey through The Odin Project โ€” NodeJS