logo

Architecture

Understanding th architecture and structure.

Poveroh repository is a monorepo that contains multiple packages and scripts, powered by Turborepo.

There are 3 main directories:

  • api: contains the backend code, including the server and database logic.
  • app: contains the frontend code, including the and Next.js application and configuration.
  • packages: contains shared code and utilities, like Prisma, UI and Utils.

All application code is written in TypeScript, and the project uses ESLint for linting and Prettier for formatting.


Backend (api)

The backend is built with Node.js and Express, and it uses Prisma as an ORM to interact with the database, which is PostgreSQL.

The backend is structured as follows:

api
├── logs
├── src
│   ├── api
│       ├── v1 
│       └── ...
│   ├── helpers
│   ├── middleware
│   └── utils
|── types
├── .env (linked to .env in root folder)
├── api.dockerfile
├── package.json
├── tsconfig.json

Logs

The logs directory contains the logs generated by the backend.

This folder is not committed to the repository and is ignored by Git.

It is recommended to keep this directory clean and not commit any logs to the repository.

Helpers, middleware, and utils

The helpers, middleware, and utils directories contain various utility functions, middleware, and helper functions that are used throughout the backend code.

There folders are located in the src directory and not under versioning folder, cause is code that rarely changes.

.env file

The .env file is linked to the root .env file, so its the same environment variables in both the backend and frontend.


Frontend (app)

The frontend is built with Next.js and uses TailwindCSS for the user interface.

The frontend is structured as follows:

app
├── app
    ├── (admin)
    ├── (auth)
    ├── (logout)
    ├── ...
├── components
    |── box
    ├── form
    ├── modal
    ├── navbar
    ├── other
    ├── ...
├── config
├── context
├── hooks
├── i18n
├── lib
├── public
├── services
├── store
├── types
├── utils
├── .env (linked to .env in root folder)
├── app.dockerfile
├── ...

App

The app directory contains the main application code, including the pages and layout.

Every page and folder in the app directory is a route, and the structure of the directory reflects the structure of the routes.

Components

The components directory contains reusable components that are used throughout the application.

This directory is organized by feature, so you can find components related to a specific feature in a subdirectory.

Every dialog, form, modal, navbar, and other components are located in their respective directories.

Hooks

The hooks directory contains custom React hooks that are used throughout the application.

All hooks are organized by feature.

Store

The store directory contains the Zustand store, which is used to manage the application state.

All files in this directory are organized by feature.

Services

The services directory contains the services that are used to interact with the backend API.

All files in this directory are organized by feature.


CDN, files and assets

All files and assets you upload in the application needs to be saved somewhere.

We use a library called BeyCloud that provides a unified interface for uploading and managing files across multiple storage providers.

Depending on the configuration specified in the .env file, you can use different storage providers:

  • Local: files are saved in a local directory.
  • AWS S3: files are saved in AWS S3 bucket.
  • Azure: files are saved in Azure Blob Storage.
  • Google Cloud Storage: files are saved in Google Cloud Storage.
  • DigitalOcean: files are saved in DigitalOcean Spaces.

To run Poveroh locally and use the local file system for file storage, you can use the CDN Docker setup provided by NGINX.

This setup maps the local folder to a URL (localhost:3002), allowing you to access uploaded files from anywhere.


Last Updated: 12 luglio 2025
Open an issue