Skip to content

robinucar/smartzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

289 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧩 Smartzer Tech Test – Full Stack Monorepo

A full-stack user management system built for the Smartzer tech test using a modern Nx monorepo with a flat folder structure. It features:

  • βœ… A REST API backend (Node.js + Express)
  • βœ… A React + Vite frontend (styled with styled-components)
  • βœ… Shared types across backend and frontend
  • βœ… End-to-end tests, component tests, and CI/CD
  • βœ… Dockerised development and deployment

πŸ—‚οΈ Project Structure

This Nx workspace uses the flat folder structure (Nx 20+), where all apps and libraries are placed directly in the root.

.
β”œβ”€β”€ backend/               # REST API (Express)
β”œβ”€β”€ frontend/              # React + Vite frontend
β”œβ”€β”€ shared-types/          # Shared User type definitions
β”œβ”€β”€ backend-e2e/           # E2E tests for backend
β”œβ”€β”€ frontend-e2e/          # E2E tests for frontend
β”œβ”€β”€ .github/workflows/     # GitHub Actions CI workflows
β”œβ”€β”€ docker-compose.yml     # Docker orchestration for local dev
β”œβ”€β”€ README.md              # This file

βš™οΈ Technologies Used

πŸ›  Backend

  • Node.js + Express

  • TypeScript

  • REST API with PostgreSQL

  • Jest (unit tests)

  • Docker

🎨 Frontend

  • React + TypeScript

  • Vite (for fast builds and dev server)

  • TanStack Query for API communication

  • styled-components for styling

  • Jest (Unit test)

  • Docker

πŸ“¦ Setup & Running Locally

  1. Clone the repository
git clone https://github.com/robinucar/smartzer-tech-test.git
cd smartzer-tech-test
  1. Make sure /frontend has .env file and set:
VITE_API_URL=http://localhost:3333/api
  1. Start PostgreSQL database via Docker
docker run --name smartzer-db \
  -e POSTGRES_USER=postgres \
  -e POSTGRES_PASSWORD=password \
  -e POSTGRES_DB=smartzer-tech-test \
  -p 5434:5432 \
  -d postgres:14

This will Start a local database named smartzer-tech-test

  • Start a local database named smartzer-tech-test
  • Use postgres as both the username and password
  • Expose the DB on port 5434
  1. Configure the root .env file
DATABASE_URL=postgresql://postgres:password@localhost:5434/smartzer-tech-test
  1. Install dependencies
npm install
  1. Push Prisma schema to create tables
npx prisma db push
  1. Start the backend
nx serve backend

Backend will be available at:

http://localhost:3333/api/users
  1. Optional: To start both backend and frontend together locally:
npm install --save-dev concurrently
npm run dev

🐳 Docker Compose

To run both backend and frontend in containers:

docker compose up --build

Then access:

πŸš€ CI/CD – GitHub Actions

This project uses GitHub Actions for continuous integration and Docker publishing.

βœ… Backend CI (.github/workflows/backend.yml)

Runs on every push or PR to main involving backend files:

  • βœ… Lints backend code: npx nx lint backend

  • βœ… Runs backend tests: npx nx test backend

  • βœ… Builds the backend: npx nx build backend

  • βœ… On main branch, builds and pushes a Docker image:

robinwinters/smartzer-backend:latest

robinwinters/smartzer-backend:

πŸ“„ Uses version from backend/package.json

βœ… Frontend CI (.github/workflows/frontend.yml)

Triggered on push or PR to main affecting frontend files:

  • βœ… Lints frontend code: npx nx lint frontend

  • βœ… Builds the frontend: npx nx build frontend

  • βœ… Runs frontend tests: npx nx test frontend

  • βœ… On main, builds and pushes Docker image:

    • robinwinters/smartzer-frontend:latest

    • robinwinters/smartzer-frontend:

πŸ“„ Uses version from frontend/package.json

πŸ”„ Docker Compose Auto-Publish (.github/workflows/publish-compose.yml)

After a successful push to main:

  • βœ… Generates a docker-compose.yml referencing the latest pushed images
  • βœ… Commits and pushes it back to the repo automatically

πŸ€– Dependency Updates with Renovate

This project uses Renovate to automate dependency updates across the entire monorepo.

  • βœ… Runs daily via GitHub Actions

  • βœ… Scans all package.json files in the flat Nx workspace

  • βœ… Opens PRs when outdated or vulnerable dependencies are found

  • βœ… Groups related updates (e.g. @nx/, @types/) into a single PR

  • βœ… Requires CI to pass before anything can be merged

πŸ“ Config: renovate.json βš™οΈ Workflow: renovate.yml

Dependency Dashboard will appear under GitHub Issues when updates are available.

🐳 Docker Compose Setup

  1. πŸŒ€ Download docker-compose.yml (optional if not cloned)

To run the entire project (frontend + backend) using Docker Compose:

curl -O https://raw.githubusercontent.com/robinucar/smartzer-tech-test/main/docker-compose.yml
  1. πŸš€ Start the stack
docker-compose up --build

This will:

πŸ›‘ Stop and remove containers

docker-compose down

πŸ” Rebuild containers after changes

docker-compose up --build

πŸ§ͺ User Stories

  • βœ… As a user, I can view users in both List and Grid format.

  • βœ… As a user, I can create, edit, and delete users using a clean, accessible form.

  • βœ… As a user, I can toggle between views, and my preference is remembered after a refresh.

  • βœ… As a user, I can preview full-size profile image and download a original-size profile image.

  • βœ… As a user, I can submit a form without a bio, since it is optional.

  • βœ… As a user, I can see my date of birth displayed in YYYY-MM-DD format.

  • βœ… As a user, I can add a middle name along with my first and last name.

  • βœ… As a user, I cannot add numbers or special characters inside name fields.

  • βœ… As a user, I cannot submit an invalid email address.

  • βœ… As a user, I cannot use an email address that already exists.

  • βœ… As a user, I see clear validation messages when I make mistakes.

πŸ”§ Potential Improvements

  • πŸš€ Cloud Deployment: Deploy to platforms like Render, Railway, Fly.io, or AWS/GCP for hosting backend, frontend, and database in a production environment.
  • πŸ” User Authentication with AWS Cognito: Add secure login, signup, and session management using Amazon Cognito, enabling OAuth2 and JWT support.
  • πŸŒ— Dark Mode / Theming: Add support for light/dark themes and save user preference.

🧠 Diagrams & Screenshots

Located in the /docs/ directory:

πŸ“˜ Further Documentation

For more in-depth details on each part of the system, check the individual README files:

  • backend/README.md – API endpoints, test setup, and architecture notes

  • frontend/README.md – Views, state management, form behavior, and Cypress testing

  • shared-types/README.md – Shared User model and type definitions

  • husky/ – Pre-commit hooks for linting, formatting, and security checks

πŸ“ Each app is self-documented to ensure modular understanding and easy onboarding.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors