Full-Stack Software Engineer - Technical Test
Overview
The purpose of this test is to evaluate the candidate's ability to work with both the backend and frontend, manage state effectively, handle database operations, and integrate with APIs. The test includes tasks for building an API using Express and creating a React-based client to interact with the API.
Instructions
You are tasked with creating a full-stack application for managing users. The application must include the following features:
Backend Requirements (Express)
-
Authentication
- Implement a simple JWT-based authentication system.
- Include endpoints for:
- Login: Accepts email and password, validates them against the database, and returns a JWT.
- Protected Routes: Middleware to validate the JWT for protected routes.
- Seed the database with at least one default user (e.g.,
admin@example.com, password: password).
-
User Management API
- Create the following endpoints:
-
GET /users: Returns a paginated, filtered, and searchable list of users.
- Query Parameters:
-
page (number): Page number for pagination.
-
limit (number): Number of users per page.
-
role (optional): Filter by role (e.g., Admin, User).
-
status (optional): Filter by status (Active/Inactive).
-
search (optional): Search by partial matches in name or email.
-
POST /users: Creates a new user.
-
PUT /users/:id: Updates an existing user by ID.
-
DELETE /users/:id: Deletes a user by ID.
- Validate all incoming data (e.g., email format, required fields).
-
Database
- Use PostgreSQL or MongoDB to store user data.
- User Schema:
-
id (auto-generated)
-
firstName
-
lastName
-
email (unique)
-
phoneNumber
-
role (Admin/User)
-
status (Active/Inactive)
-
address (object with fields: street, number, city, postalCode)
-
profilePicture (URL)
- Seed the database with 50 sample users.
Frontend Requirements (React)
-
Login Page
- A form where users can log in using their email and password.
- On successful login, store the JWT in local storage or cookies and redirect the user to the dashboard.
- Show an error message for invalid credentials.
-
Dashboard
- Display a table of users with the following columns:
- Name
- Email
- Phone Number
- Role
- Status
- Actions: Edit and Delete buttons
- Features:
- Fetch users from the
/users endpoint (paginated, filtered, and searchable).
- Include controls for:
- Search: Text input for searching by name or email.
- Filters: Dropdowns for filtering by Role and Status.
- Pagination: Buttons for navigating between pages.
- Show a loading spinner while data is being fetched.
Use Skeleton
-
Add User Form
-
Edit User
- Clicking the "Edit" button in the table should open a form pre-filled with the user’s current data.
- Save changes by sending a
PUT request to /users/:id.
-
Delete User
- Clicking the "Delete" button should prompt a confirmation dialog.
- On confirmation, delete the user using the
/users/:id endpoint.
Bonus Features (Optional)
-
Implement a Role-Based Access Control:
- Allow only Admin users to access the dashboard and perform user management.
On the backend and frontend, implement role-based access control (RBAC) to ensure that only the roles permitted can access the sections marked with the role permissions.
THE ROLES SEED ARE:
- User
- Admin
- Manager
- Supplier
- Employee
- Customer
AND THE PERMISSIONS ARE:
- application:all - user:read
- user:create - user:update
- user:delete - role:read
- role:create - role:update
- role:delete - role:assign
- role:assign - role:unassign
- category:read - category:create
- category:update - category:delete
- model:read - model:create
- model:update - model:delete
- settings:read - settings:create
- settings:update - settings:delete
- project:read - project:create
- project:update - project:delete
The permissions are assigned to the roles Without criteria, only for demo purposes.
-
Use TypeScript for both the frontend and backend.
-
Style the frontend using Material-UI, TailwindCSS, or another modern UI library.
Use Shadcn for Frontend
-
Include Unit Tests and Integration Tests for key features.
-
Add pagination controls to show the total number of users and the current page.
-
Use Docker to containerize the app (both frontend and backend).
-
Implement a global state management solution (e.g., Redux, Recoil, Zustand).
Use Redux
Deliverables
- Source Code:
- A GitHub repository containing both the frontend and backend projects.
- Include clear folder structures and comments.
- README.md:
- How to set up and run the project (backend, frontend, and database).
- A brief explanation of your implementation and any decisions made.
- List of libraries or frameworks used.
- Any challenges faced and how they were overcome.
- Postman Collection (Optional):
- Export a Postman collection for the backend API.
Evaluation Criteria
- Functionality: Does the app meet the requirements?
- Code Quality: Is the code clean, readable, and well-structured?
- UI/UX Design: Is the interface intuitive and visually appealing?
- Problem-Solving: How well were challenges addressed?
- Bonus Features: Extra points for implementing optional tasks.
How to Submit
- Push your code to a public GitHub repository.
- Share the repository link and any additional files (e.g., Postman collection) via email.
Good luck! We look forward to reviewing your work!
Note: User credentials for login are:
// Data generated, only for demo purposes
user.email = "GonzaloVinegas@gmail.com";
user.role = "Admin";
user.password = "password123";
//master password: password123
//for all other users