Code Monkey home page Code Monkey logo

app-template's Introduction

Web App Template │ Structure

Web app template for python frameworks(FastAPI, Flask, Bottle...)

Requirements

Backend local development

  • First Time Build:
cd scripts/
./first-build.sh
  • Start the stack with Docker Compose:
docker-compose build
docker-compose up -d
  • Now you can open your browser and interact with these URLs:

Frontend, built with Docker, with routes handled based on the path: http://localhost

Backend, JSON based web API based on OpenAPI: http://localhost/api/

Automatic interactive documentation with Swagger UI (from the OpenAPI backend): http://localhost/docs

Alternative automatic documentation with ReDoc (from the OpenAPI backend): http://localhost/redoc

Note: The first time you start your stack, it might take a minute for it to be ready. While the backend waits for the database to be ready and configures everything. You can check the logs to monitor it.

To check the logs, run:

docker-compose logs

To check the logs of a specific service, add the name of the service, e.g.:

docker-compose logs backend

.env file:

The .env file is the one that contains all your configurations, generated keys and passwords, etc.

Depending on your workflow, you could want to exclude it from Git, for example if your project is public. In that case, you would have to make sure to set up a way for your CI tools to obtain it while building or deploying your project.

One way to do it could be to add each environment variable to your CI/CD system, and updating the docker-compose.yml file to read that specific env var instead of reading the .env file.

DEBUG=True
OPENAPI_URL=/openapi.json
DOCS_URL=/docs
REDOCS_URL=/redoc
PROJECT_NAME=
SECRET_KEY=

MARIADB_USER='us3r'
MARIADB_PASS='123456'
MARIADB_HOST='db'
MARIADB_DB='db'

SMTP_HOST=
SMTP_USER=
SMTP_PASSWORD=
SMTP_EMAIL=
SMTP_TLS=True
SMTP_PORT=587

SENTRY_DSN=

VUE_APP_DOMAIN_DEV=localhost
VUE_APP_DOMAIN_STAG=stag.projeto1teste.com
VUE_APP_DOMAIN_PROD=projeto1teste.com
VUE_APP_NAME=Teste
VUE_APP_ENV=development

Default directory tree:

app
├── backend('src')
│   ├── api
│   │   ├── router.py
│   │   └── routes
│   │       ├── auth_v1.py
│   ├── app
│   │   ├── router.py
│   │   └── routes
│   │       └── main.py
│   ├── certificates
│   │   └── docker_CA.crt
│   ├── core
│   │   ├── config.py
│   │   ├── databases.py
│   │   ├── schema
│   │   │   ├── json
│   │   │   │   └── countries-states-cities.json
│   │   │   └── sql
│   │   │       └── database.sql
│   │   └── security.py
│   ├── Dockerfile
│   ├── main.py
│   ├── requirements.txt
│   ├── static
│   │   ├── css
│   │   │   └── style.css
│   │   └── mobile
│   │       └── manifest.json
│   └── templates
│
│
│
├── frontend
│   ├── babel.config.js
│   ├── Dockerfile
│   ├── nginx-backend-not-found.conf
│   ├── nginx.conf
│   ├── package.json
│   ├── public
│   │   ├── favicon.ico
│   │   ├── img
│   │   │   └── icons
│   │   ├── index.html
│   │   ├── manifest.json
│   │   └── robots.txt
│   ├── README.md
│   ├── src
│   │   ├── App.vue
│   │   ├── assets
│   │   │   └── logo.png
│   │   ├── components
│   │   │   └── HelloWorld.vue
│   │   ├── config.js
│   │   └── main.js
│   └── tests
│       └── unit
│           └── upload-button.spec.ts
│
│
├── docker-compose.yml
├── README.md
└── scripts
    └── first-build.sh

Development URLs

Development URLs, for local development.

Frontend: http://localhost

Backend: http://localhost/api/

Automatic Interactive Docs (Swagger UI): https://localhost/docs

Automatic Alternative Docs (ReDoc): https://localhost/redoc

app-template's People

Contributors

legioz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.