NOTE: Before using this template, you need to install
pnpm(only for development),dockeranddocker compose.
Create a new project based on this template using degit:
pnpx degit CitRUSprod/docker-compose-starter my-app
cd my-app
pnpm iThe launch is done through docker compose, but with scripts scripts/dev and scripts/prod:
scripts/dev <docker compose command>
scripts/prod <docker compose command>Run the project by entering these commands and open http://localhost:6600 in your browser:
# Development
scripts/dev up -d
pnpm dev # or "cd apps/<app>" and "pnpm dev"
# Production
scripts/startscripts/dev up -d # Start
scripts/dev down # Stop
scripts/dev logs <app> # View app logs
scripts/dev exec <app> sh # Enter the app container
scripts/dev <docker compose command> # Any docker compose commandscripts/prod up -d # Start
scripts/prod down # Stop
scripts/prod logs <app> # View app logs
scripts/prod exec <app> sh # Enter the app container
scripts/prod <docker compose command> # Any docker compose command
# or shortcuts
scripts/start # Start
scripts/stop # Stop
scripts/restart # Restart- Enter this command and edit the
.envfile:
scripts/clone-env- Start required docker containers for development:
scripts/dev up -d- Install project dependencies:
pnpm i- Build packages:
pnpm build- Start web and api in development mode:
pnpm dev- Enter this command and edit the
.envfile:
scripts/clone-env- Start required docker containers for production:
scripts/startAfter completing all steps, the application will be available at http://localhost:<WEBSITE_PORT> (default is http://localhost:6600).
apps- Applicationspackages- Local librariesconfigs- Configuration files (docker, nginx, etc.)scripts- Project management scripts (start, stop, restart, etc.)storage- Storage directory for backups and other data that should not be in the repository
Commit with commitizen:
pnpm commitCheck types with tsc:
pnpm check-typesLint with linters:
pnpm lintFormat with formatters:
pnpm formatAll environment variables are written to the .env file. If it doesn't exist, just enter this command:
scripts/clone-env