Skip to content

Zamelane/effective-mobile-test-task

Repository files navigation

EN | RU

Effective Mobile Test Task 💻

Technologies | Getting Started | API Endpoints | Collaborators | Contribute

A test task from effective mobile

📱 Contact with me

📝 Technical specification

🎨 Layout

Image Image Image Image Image Image Image Image

💻 Technologies

  • Vite (React Router v7)
  • React
  • Express
  • TypeScript
  • Drizzle ORM (PostgreSQL)

🚀 Getting started

The project includes several components: a basic web application for interacting with the API, an API server, as well as packages containing common data types and database access.

It is recommended to use the web application in conjunction with the API server through the static content mechanism.

Detailed instructions on how to set up and launch the project are provided in the following sections.

Prerequisites

To implement the project, the following software components are required:

Cloning

Copy this repository and navigate to its root directory, and then install the dependencies:

git clone https://github.com/Zamelane/effective-mobile-test-task
cd effective-mobile-test-task
npm i

Config .env variables

It is necessary to create a configuration file with the .env extension.

To do this, use the .env.example file as a template. In the created .env file, you need to enter your credentials for accessing the database and other parameters, if necessary.

During the system initialization task, it is recommended to make changes exclusively to the section on DATABASE configuration. It is important to specify the correct connection parameters to your database.

############
# DATABASE #
############
DB_USER=postgres
DB_PASSWORD=postgres
DB_HOST=localhost
DB_PORT=5432
DB_NAME=emtt

#######
# API #
#######
API_PORT=3000
API_JWT_SECRET=zR8J0MA9jh6lfyQMAeeYFUknQdPS6lM7

NODE_ENV=production # development

Starting

Before starting the project, the following steps must be performed::

1. Creating a database structure and initializing it with test data:
  • Make sure that the database specified in the .env configuration file exists.
  • Check the availability of the public schema in the database and its current state (it should be empty).
2. Generating tables in the database:

Run the command in the root of the repository to create the table structure:

npm run db:migrate
3. Populating the database with test data:

To enter the test data, run the following command:

npm run db:seed
4. Building the web part of the project:

Assemble the web components of the project using the command:

npm run web:build
5. Server startup and health check:

After completing the above steps, start the server and follow the link displayed in the console.

npm run api:dev

Data from the administrator account
Login: admin@admin.com
Password: admin!

📍 API Endpoints

The main API routes are shown here and the expected request types are indicated.

For clarity, the prefix /api is omitted. Take this into account before using! ​

route description
POST /login User authentication in the system. For more information, see the request details section.
POST /registration Registration of a new user in the system. For more information, see the request details section.
GET /users/:id Getting information about a specific user by their ID. For more information, see the request details section.
POST /users/:id Updating user profile data with the specified ID. For more information, see the request details section.
POST /users/:id/ban Blocking (ban) the user by ID. For more information, see the request details section.
POST /users/:id/unban Unblocking (removing ban) a user by ID. For more information, see the request details section.
GET /usersList/:page?pageSize={number} Getting a page-by-page list of users with the ability to specify the page size. For more information, see the request details section.

POST /login

REQUEST

{
  "email": "admin@admin.com",
  "password": "admin!"
}

RESPONSE

{
  "userInfo": {
    "id": 853,
    "firstName": "Admin",
    "lastName": "Adminovich",
    "middleName": "",
    "birthDate": "2010-10-09T00:00:00.000Z",
    "email": "admin@admin.com",
    "role": "admin",
    "isActive": true,
    "createdAt": "2025-08-19T15:59:26.943Z",
    "updatedAt": "2025-08-19T15:59:26.943Z"
  },
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

POST /registration

REQUEST

{
  "firstName": "Имя",
  "lastName": "Фамилия",
  "middleName": "Отчество",
  "birthDate": "2025-08-01T00:00:00.000Z",
  "email": "superTest@mail.ru",
  "password": "TestPass1!"
}

RESPONSE

{
  "userInfo": {
    "id": 956,
    "firstName": "Имя",
    "lastName": "Фамилия",
    "middleName": "Отчество",
    "birthDate": "2025-08-01T00:00:00.000Z",
    "email": "superTest@mail.ru",
    "role": "user",
    "isActive": true,
    "createdAt": "2025-08-19T18:06:20.273Z",
    "updatedAt": "2025-08-19T18:06:20.273Z"
  },
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

GET /users/:id

RESPONSE

{
  "id": 956,
  "firstName": "Имя",
  "lastName": "Фамилия",
  "middleName": "Отчество",
  "birthDate": "2025-08-01T00:00:00.000Z",
  "email": "superTest@mail.ru",
  "role": "user",
  "isActive": true,
  "createdAt": "2025-08-19T18:06:20.273Z",
  "updatedAt": "2025-08-19T18:06:20.273Z"
}

POST /users/:id

REQUEST

{
  "firstName": "Имя",
  "lastName": "Фамилия",
  "middleName": "Отчество",
  "birthDate": "2025-08-01T00:00:00.000Z",
  "email": "superTest@mail.ru"
}

RESPONSE

{
  "id": 956,
  "firstName": "Имя",
  "lastName": "Фамилия",
  "middleName": "Отчество",
  "birthDate": "2025-08-01T00:00:00.000Z",
  "email": "superTest@mail.ru",
  "role": "user",
  "isActive": true,
  "createdAt": "2025-08-19T18:06:20.273Z",
  "updatedAt": "2025-08-19T18:06:20.273Z"
}

POST /users/:id/ban

RESPONSE

{
  "id": 956,
  "firstName": "Имя",
  "lastName": "Фамилия",
  "middleName": "Отчество",
  "birthDate": "2025-08-01T00:00:00.000Z",
  "email": "superTest@mail.ru",
  "role": "user",
  "isActive": false,
  "createdAt": "2025-08-19T18:06:20.273Z",
  "updatedAt": "2025-08-19T18:06:20.273Z"
}

POST /users/:id/unban

RESPONSE

{
  "id": 855,
  "firstName": "Андрей",
  "lastName": "Васильев",
  "middleName": "Петровна",
  "birthDate": "1992-10-01T00:00:00.000Z",
  "email": "peter.johnson.474@hotmail.com",
  "role": "user",
  "isActive": true,
  "createdAt": "2025-08-19T15:59:27.046Z",
  "updatedAt": "2025-08-19T15:59:27.046Z"
}

GET /usersList/:page?pageSize={number}

RESPONSE

{
  "data": [
    {
      "id": 853,
      "firstName": "Admin",
      "lastName": "Adminovich",
      "middleName": "",
      "birthDate": "2010-10-09T00:00:00.000Z",
      "email": "admin@admin.com",
      "role": "admin",
      "isActive": true,
      "createdAt": "2025-08-19T15:59:26.943Z",
      "updatedAt": "2025-08-19T15:59:26.943Z"
    },
    <...>
  ],
  "page": 1,
  "pageSize": 8
}

🤝 Collaborators

Special thank you for all people that contributed for this project.

Evgeny Malinin Profile Picture
Evgeny Malinin

📫 Contribute

To contribute to the project, follow these steps:

  1. git clone https://github.com/zamelane/effective-mobile-test-task.git
  2. git checkout -b feature/NAME
  3. Follow the commit templates
  4. Open a pool request with a description of the solved problem or implemented function, if any, attach a screenshot of the visual changes and wait for verification!

Documentations that might help

📝 How to create a Pull Request

💾 Commit pattern

About

💻 A test task from effective mobile

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published