A Full Stack product and user management platform.
Velumi is a Full Stack web application designed to manage a product catalog through a modern user interface and a REST API. It includes JWT-based authentication, role-based access control, and an administration dashboard for managing users, products, and platform statistics.
The project is built using React and TypeScript on the frontend, Spring Boot on the backend, and MySQL as its database management system.
- Features
- Technologies
- Project Architecture
- Prerequisites
- Installation and Setup
- Environment Variables
- Running the Project
- REST API
- Authentication and Security
- Data Model
- Available Scripts
- Author
- Browse the product catalog.
- Search products by name.
- Filter products by category.
- View product information and prices.
- Manage product images.
- User registration.
- User login.
- JWT-based authentication.
- Password hashing using BCrypt.
- Token-based session management.
- Role-based access control.
The administration dashboard provides the following functionality:
- View registered users.
- Display user roles.
- Filter users by name.
- Browse the complete product catalog.
- View general platform statistics.
- Display the total number of users, products, and categories.
Administrative features are restricted to users with the ROLE_ADMIN role.
| Technology | Purpose |
|---|---|
| React 19 | User interface development |
| TypeScript | Static typing |
| Vite 8 | Development server and build tool |
| Tailwind CSS 4 | Styling and responsive design |
| Motion | Animations |
| Lucide React | Icons |
| JWT Decode | JWT token decoding |
| Technology | Purpose |
|---|---|
| Java 21 | Programming language |
| Spring Boot 4.1 | Backend framework |
| Spring Web | REST API development |
| Spring Security | Authentication and authorization |
| Spring Data JPA | Data persistence |
| Hibernate | Object-relational mapping |
| MySQL | Relational database |
| JWT | Token-based authentication |
| BCrypt | Password hashing |
| Maven | Dependency and build management |
| Lombok | Boilerplate code reduction |
The project is divided into two independent modules: frontend and backend.
fullstack-lab/
│
├── backend/
│ ├── src/
│ │ ├── main/
│ │ │ ├── java/org/dam/velumi/
│ │ │ │ ├── config/
│ │ │ │ ├── controller/
│ │ │ │ ├── manager/
│ │ │ │ ├── model/
│ │ │ │ ├── repository/
│ │ │ │ ├── service/
│ │ │ │ └── VelumiApplication.java
│ │ │ │
│ │ │ └── resources/
│ │ │ └── application.properties
│ │ │
│ │ └── test/
│ │
│ ├── uploads/
│ │ └── productos/
│ │
│ ├── pom.xml
│ ├── mvnw
│ └── mvnw.cmd
│
├── frontend/
│ ├── public/
│ ├── src/
│ │ ├── assets/
│ │ ├── components/
│ │ │ ├── admin/
│ │ │ └── ui/
│ │ ├── services/
│ │ ├── types/
│ │ ├── App.tsx
│ │ └── main.tsx
│ │
│ ├── package.json
│ ├── vite.config.ts
│ └── tsconfig.json
│
└── README.md
- config: Security, JWT, and CORS configuration.
- controller: REST API endpoint definitions.
- manager: Authentication-related components.
- model: Database entities.
- repository: Data access and database operations.
- service: Business logic.
- uploads: Product image storage.
- components: Reusable UI components.
- components/admin: Administration dashboard components.
- components/ui: Shared visual components.
- services: API communication and authentication management.
- types: TypeScript interfaces and type definitions.
- assets: Static assets and graphical resources.
Make sure the following tools are installed before running the project:
- Java JDK 21 or later.
- Node.js compatible with Vite 8.
- npm.
- MySQL.
- Git.
Recommended development environments:
- IntelliJ IDEA for the backend.
- Visual Studio Code for the frontend.
git clone https://github.com/Mahu2121/fullstack-lab.git
cd fullstack-labCreate a MySQL database:
CREATE DATABASE velumi;The application uses Spring Data JPA and Hibernate to manage entities and update the database schema.
Navigate to the backend directory:
cd backendCreate a .env file in the backend directory:
DATASOURCE_URL=jdbc:mysql://localhost:3306/velumi
DATASOURCE_USERNAME=root
DATASOURCE_PASSWORD=your_password
JWT_SECRET=your_secret_key_at_least_32_characters_longReplace the values with your local database credentials and a secure JWT secret.
From the project root, navigate to the frontend directory:
cd frontendInstall the dependencies:
npm installThe backend requires the following configuration values:
| Variable | Description |
|---|---|
DATASOURCE_URL |
MySQL database connection URL |
DATASOURCE_USERNAME |
Database username |
DATASOURCE_PASSWORD |
Database password |
JWT_SECRET |
Secret key used to sign JWT tokens |
Make sure to configure these values before starting the backend.
The frontend and backend must be started separately using two terminal windows.
Navigate to the backend directory.
On Linux or macOS:
./mvnw spring-boot:runOn Windows:
mvnw.cmd spring-boot:runThe backend will be available at:
http://localhost:8080
Navigate to the frontend directory:
npm run devThe frontend will be available at:
http://localhost:5173
The application exposes the following REST endpoints.
Base URL: /api/auth
| Method | Endpoint | Description |
|---|---|---|
| POST | /register |
Register a new user |
| POST | /login |
Authenticate a user |
Example login request:
{
"username": "username",
"password": "password"
}The response contains a JWT token:
{
"token": "jwt_token"
}Base URL: /api/productos
| Method | Endpoint | Description | Access |
|---|---|---|---|
| GET | / |
Retrieve all products | Public |
| POST | / |
Create a product | Authenticated |
| GET | /{id}/imagen |
Retrieve a product image | Public |
Base URL: /api/admin/usuarios
| Method | Endpoint | Description | Access |
|---|---|---|---|
| GET | / |
Retrieve registered users | Administrator |
Administrative endpoints require a valid JWT token with the ROLE_ADMIN role.
Velumi implements an authentication system using Spring Security and JSON Web Tokens.
The authentication workflow is as follows:
- The user submits their login credentials.
- The backend validates the credentials.
- If authentication succeeds, the backend generates a JWT signed using HS256.
- The frontend stores the token in
localStorage. - Protected requests include the token in the
Authorizationheader. - Spring Security validates the token and checks the user's permissions.
Example authorization header:
Authorization: Bearer <token>The application defines two user roles:
| Role | Description |
|---|---|
ROLE_USER |
Standard user |
ROLE_ADMIN |
Administrator |
Newly registered users are automatically assigned the ROLE_USER role.
Administrator privileges must be assigned through user data management.
The Usuario entity represents registered users.
| Field | Type | Description |
|---|---|---|
| id | Long | Unique identifier |
| username | String | Username |
| password | String | Hashed password |
| rol | String | User role |
The Product entity represents the products available in the catalog.
| Field | Type | Description |
|---|---|---|
| id | Long | Unique identifier |
| nombre | String | Product name |
| precio | double | Product price |
| descripcion | String | Product description |
| stock | int | Available stock |
| imagenUrl | String | Image URL |
| categoria | String | Product category |
| fechaCreacion | Date | Creation date |
| activo | Boolean | Product status |
| imagenNombre | String | Image filename |
Run these commands from the frontend directory:
| Command | Description |
|---|---|
npm run dev |
Start the development server |
npm run build |
Build the application for production |
npm run lint |
Run ESLint |
npm run preview |
Preview the production build |
Run these commands from the backend directory.
Execute tests:
./mvnw testBuild the application:
./mvnw clean package- The frontend uses
http://localhost:8080as its API base URL. - The backend allows CORS requests from
http://localhost:5173. - JWT tokens have a one-hour expiration time.
- Hibernate uses the
updatestrategy to synchronize the database schema. - Product images are stored in
backend/uploads/productos/.
For production deployment, database credentials, API URLs, CORS settings, and security secrets should be adapted to the target environment.
Mahu2121
- GitHub: @Mahu2121
- Repository: fullstack-lab
Built with React, TypeScript, Spring Boot, and MySQL.