- Flask
- Redis
- MySQL
- Docker/docker compose
- SqlAlchemy
- Nginx
- MVC Architecture
- LAMP Stack
- Bootstrap 5 (MDB)
- JWT authentication
- webpack
- eslint
- prettier
- TypeScript
- Sentry
- Login/Logout
- Register
- Forgot password (Send an email with a token to reset the password)
- Dashboard (Restricted access with admin role)
- Clients CRUD
- Users CRUD
- Built with typescript and webpack
- Responsive design
- Clone the repository
git clone https://github.com/Datzu712/For_Life_S.A.git
- Setup the environment variables
Rename the
.flaskenv.example
file to.flaskenv
and set the values for the environment variables
FLASK_APP=wsgi
FLASK_DEBUG=True
FLASK_ENV=development
FLASK_RUN_PORT=8080
FLASK_RUN_HOST=0.0.0.0
MYSQL_URL=mysql+pymysql://admin:root@mysql:3306/uni
# Mysql conf for docker (you can leave it blank if you are not using docker)
MYSQL_USERNAME=admin
MYSQL_PASSWORD=root
MYSQL_HOST=mysql
MYSQL_PORT=3306 # redirect port of docker, mysql inside docker always would be 3306
MYSQL_DATABASE=uni
REDIS_URL=redis://admin:root@redis:6379/0
# Redis conf for docker (you can leave it blank if you are not using docker)
REDIS_USERNAME=admin
REDIS_PASSWORD=root
REDIS_PORT=6379
SECRET_KEY=secret # secret key for the JWT token and flask sessions (we recommend to use different secrets for both)
SMTP_SERVER=smtp.example.com
SMTP_PORT=587
SMTP_USERNAME=your_username
SMTP_PASSWORD=password_token # you must use a token instead of your password
[email protected]
[email protected]
APP_URL=http://localhost:5000
SENTRY_DSN=your_sentry_dsn
- Create a virtual environment
python3 -m venv .venv
- Activate the virtual environment (Linux)
source .venv/bin/activate
4.1 Activate the virtual environment (Windows)
.venv\Scripts\activate
- Install the dependencies
pip install -r requirements.txt
- Run the application
flask run
- Generate the certificates for the Nginx server
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout nginx/ssl/cert.key -out nginx/ssl/cert.crt
- Run the docker compose command
docker compose --env-file .flaskenv up
- Access the application on
https://localhost:443
To stop the application run
docker compose --env-file .flaskenv down
The application is built with webpack and typescript, to compile the files run the following command
# production build
npm run build:prod
# development build
npm run build:dev
# watch mode
npm run watch
I recommend to see the webpack.config.mjs
file to see how the files are compiled and how entry points are defined (because it's like a custom configuration). Probably you should change the way that entries are loaded, it's up to you.