Makefile Tasks for FNZ Development Environment
This document explains each task defined in the Makefile, including hidden and helper tasks. Use this as a reference for setting up, running, and managing your development environment.
Table of Contents
Note: All make targets beginning with a
.are hidden helper tasks and are not meant to be run directly. They are typically used within other tasks.
General Tasks
default
- Description: Launches the development environment by entering the
devbox shell. - Usage:
make - Notes: This is the default task and will run if you use
makewithout specifying a target.
launch
- Description: Complete setup for the development environment.
- Usage:
make launch - Steps:
- Installs all npm dependencies.
- Brings up the Docker containers using
make .up. - Migrates and seeds the database using
make .seed-db. - Prints a welcome message to indicate the environment is ready.
dev-backend
- Description: Runs the backend in development mode.
- Usage:
make dev-backend - Notes: Uses
lernato run backend development tasks within the@fnz/backendscope.
dev-frontend
- Description: Runs the frontend in development mode.
- Usage:
make dev-frontend - Notes: Uses
lernato run frontend development tasks within the@fnz/frontendscope.
dev-docs
- Description: Runs the documentation server in development mode.
- Usage:
make dev-docs - Notes: Uses
lernato run the documentation tasks within the@fnz/docsscope.
dev-all
- Description: Runs backend, frontend, and documentation servers simultaneously.
- Usage:
make dev-all - Notes: Prefer running each command separately (
dev-backend,dev-frontend, anddev-docs) to view logs more clearly.
Docker Management Tasks
down
- Description: Tears down all Docker containers and prunes Docker volumes.
- Usage:
make down - Notes: This will stop all containers and clean up volumes, which may be helpful if you encounter issues or need a fresh start.
.up (Helper Task)
- Description: Builds and starts Docker containers in detached mode, waiting until they’re fully ready.
- Usage:
make .up - Notes: This helper task is used internally by the
launchtask but should not be run directly.
Database Management
proxy-db
- Description: Proxies to the remote database at port
15432on the local machine. - Usage:
make proxy-db - Notes: Useful for connecting directly to the database with tools like
psqlor GUI clients.
.seed-db (Helper Task)
- Description: Runs database migrations and seeds the database.
- Usage:
make .seed-db - Steps:
- Executes
db:migrate-devwithin the@fnz/backendscope with concurrency set to 5. - Indicates when migration and seeding are complete.
- Executes
- Notes: This task is run automatically in
launchbut should not be run directly.
Cleanup Tasks
clean
- Description: Removes all
node_modulesandpackage-lock.jsonfiles. - Usage:
make clean - Notes: Useful for resetting dependencies if you encounter issues with installed packages.
Execution Order
For setting up your environment, follow these steps:
- Run
make launchto install dependencies, start Docker containers, and set up the database. - To work on individual components:
- Run
make dev-backendfor the backend. - Run
make dev-frontendfor the frontend. - Run
make dev-docsfor documentation.
- Run
- Use
make dev-allto run all components together, but note that logs may be easier to follow when running components separately. - For cleanup, use
make downto stop Docker containers ormake cleanto removenode_modules.
Troubleshooting
- If Docker containers fail to start or services don’t connect, try using
make downand then re-runmake launch. - For dependency-related issues, use
make cleanand re-runnpm installormake launch.
This guide provides a comprehensive overview of the Makefile tasks for setting up and managing the FNZ development environment.