This is a full-stack application built with Nest.js and Vue.js.This app provides multiple features for company management. Users can register, login and manage company and department energy consumption on this platform.
This application uses JSON Web Tokens (JWT) for authentication. When a user logs in, they receive two tokens: an access token and a refresh token.
The access token is short-lived and used to make authenticated requests to the API. It is sent in the Authorization
header of each request.
The refresh token is long-lived and used to get a new access token when the current one expires. For security, it is stored in a HttpOnly cookie in the user's browser, which protects it from being accessed by client-side scripts. The refresh token is sent to the server to issue a new access token when the current one expires.
When the access token expires, the application automatically uses the refresh token to get a new access token, allowing the user to continue using the application without needing to log in again.
This application includes the following pages:
- Home
- Register
- Login
- Department Management
- Company Management
The Home page is the landing page of the application. It provides an overview of the application and its features. Users can navigate to other parts of the application from here.
The Register page allows new users to create an account in the application. Users need to provide their details such as name, email, and password to register. After successful registration, users will be able to log in to the application with their credentials.
The Login page allows existing users to log in to the application. Users need to provide their registered email and password. After successful login, users will be able to access the features of the application.
In the Department Management page, you can add, edit, and delete departments. To add a new department, click on the "Add Department" button, fill in the department's details in the form, and click "Save".
In the Company Management page, you can add, edit, and delete companies. To add a new company, click on the "Add Company" button, fill in the company's details in the form, and click "Save".
This application supports multiple languages. You can switch between languages using the language selector in the application.
The application is designed to be responsive and provides an optimal viewing and interaction experience across a wide range of devices. Whether you're on a desktop, laptop, tablet, or smartphone, you'll be able to use all the features of the application with ease.
- Back-end: Nest.js
- Front-end: Vue.js
- Database: (Postgresql,elasticsearh)
- ORM: (Typorm)
- Other technologies: (Vuefity)
This application uses environment variables for configuration. To set up your environment variables:
- Copy the
.env.example
file and rename it to.env
. - Open the
.env
file and replace the example values with your actual values.
The .env
file should look something like this:
First, install the dependencies for the back-end:
cd backend
yarn
Then, install the dependencies for the front-end:
cd frontend
yarn
To run the back-end:
cd backend
# development
yarn start
# watch mode
yarn start:dev
# production mode
yarn start:prod
To run the front-end:
cd frontend
yarn dev