The project utilizes the following technologies and tools:
- React: A JavaScript library for building user interfaces.
- Chakra UI: A simple, modular and accessible component library that provides a set of UI components for designing and animating user interfaces.
- Axios: A Promise-based HTTP client used for making HTTP requests.
- TypeScript:: A statically typed superset of JavaScript that adds static types, is used for safer and more reliable coding.
- Vite: A next-generation front-end build tool and development server, is used for faster and leaner development.
- TypeScript: It's a typed superset of JavaScript, adding static types to the language. It helps in making the code more readable and less prone to runtime errors.
- Express: A minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
- Mongoose: An Object Data Modeling (ODM) library for MongoDB and Node.js. It manages relationships between data, provides schema validation, and translates between objects in code and the representation of those objects in MongoDB.
- Bcryptjs: A library to help in hashing passwords.
- JsonWebToken: An implementation of JSON Web Tokens for secure transmission of information between parties as a JSON object.
- Helmet: A collection of middleware functions to help secure Express apps by setting various HTTP headers.
- Joi: A powerful schema description language and data validator for JavaScript.
- Winston: A multi-transport async logging library for Node.js.
- Nodemon: A tool that helps develop Node.js based applications by automatically restarting the node application when file changes in the directory are detected.
- ESLint: A tool for identifying and reporting on patterns in JavaScript, helping developers write consistent code and find and fix errors.
- Prettier: An opinionated code formatter that enforces a consistent style by parsing your code and reprinting it with its own rules.
- MongoDB: is the database of choice.
-
Navigate to the frontend directory to install packages.
cd frontend/ && npm install -
Build the fronted
npm run build -
Preview frontend UI
npm run preview
-
Copy and create your own enviroment.
cp .env.example .env -
Navigate to the backend directory to install packages.
cd backend/ && npm install -
Run lint and format on backend
npm run lint && npm run format -
Build the backend
npm run build
Let's use files and folders to structure our backend application:
/src
βββ main.tsx
βββ App.tsx
βββ App.css
βββ theme.ts
βββ components
β βββ UserGrid
βββ hooks
β βββ useUsers.ts
β βββ useData.ts
βββ assets
β βββ vite.svg
βββ services
βββ api-client.ts
βββ http-service.ts
βββ user-service.ts
This ReactJS project has a structured and organized directory layout. Here's what each directory or file is for:
main.tsx: This is the main entry point of the React application.theme.ts: This file is used for defining the theme for styling the application. It can include colors, typography, spacing, etc.- Components: This directory contains all the React components used in the application.
- Hooks: This directory contains custom hooks, which are a way to reuse stateful logic in React.
- Assets: This directory is used to store static files like images, fonts, etc.
- Services: This directory contains service files that handle API calls and interactions with backend services.
/src
βββ index.ts
βββ startup
β βββ config.ts
β βββ routes.ts
β βββ database.ts
β βββ logging.ts
βββ common
β βββ dtos
β β βββ data-response.dto.ts
β βββ enums
β β βββ response-status.enum.ts
β βββ interceptor
β β βββ data-response.interceptor.ts
β βββ interfaces
β βββ custom-request.interface.ts
βββ presentation
β βββ routers
β βββ user-router.ts
βββ domain
β βββ interfaces
β β βββ repositories
β β β βββ user-repository.interface.ts
β β βββ use-cases
β β βββ user
β β βββ get-all-users.use-case.ts
β β βββ update-all-users.use-case.ts
β βββ models
β β βββ user.model.ts
β βββ dtos
β β βββ user.dto.ts
β βββ repositories
β β βββ user.repository.ts
β βββ use-cases
β βββ users
β βββ get-all-users.use-case.ts
β βββ update-all-users.use.case.ts
β
βββ data
βββ interfaces
β βββ data-sources
β βββ nosql-database-wrapper.interface.ts
β βββ user-data-source.interface.ts
βββ instances
β βββ user-database.ts
βββ data-sources
βββ mongodb
βββ mongodb-user-data-source.ts
-
The presentation layer would mainly be used for inputting and outputting user data (API routes).
-
The inner core domain layer holds all business logic (use cases, repositories).
-
The data layer holds all infrastructure implementations (data sources).
-
Common: include entire common stuffs of the project
-
Startup: contains files for project configuration and loading such as: config.ts, database.ts, ...
-
Use Cases: have one or more repository dependencies and will be constructor injected. Use cases are structured in a way that each use case has one method, the execute method, which holds all business logic for that use case.
-
Repository: The main purpose of the repository is to know and marshall data sources and services.
-
Frontend Site
- Add user login/logout feature.
- Improve UI/UX for both mobile and web.
-
Backend Site:
- Add comprehensive test cases.
- Add more layers to protect our application such as (middlewares, interceptors, dtos, ...).

