This is a full-stack application boilerplate by Infisical careers team with the following components:
- Backend: An API built with Express.js.
- Frontend: A user interface built with React.js.
- Database: A PostgreSQL database with query operations powered by Knex.js.
- Docker Compose: Used to orchestrate all services in the development environment.
Before starting, make sure you have the following tools installed on your system:
-
Docker (v20.10 or higher)
Install Docker -
Docker Compose (v1.29 or higher)
Docker Desktop typically includes Docker Compose. -
Node.js (v20 or higher)
Required for installing dependencies locally. Download Node.js
-
Download the repository:
- Go to the repository's page on GitHub.
- Click the green "Code" button and select "Download ZIP."
- Extract the ZIP file to your desired location.
-
Navigate to the project directory:
cd <extracted-folder>
-
Install dependencies:
Run the following commands to install dependencies for the frontend and backend:
cd client && npm install cd ../server && npm install
-
Start the development environment:
Run the following command from the root of the project directory:
docker compose -f docker-compose.dev.yml up --build
-
To stop the environment:
Run the following command:
docker compose -f docker-compose.dev.yml down
The backend uses Knex.js for managing database migrations. Database migrations help manage creating, updating and deleting table schemas. Below are the commands for creating, applying, and rolling back migrations.
Note
The Docker Compose file includes a db-migration
service that automatically runs pending migrations when the application starts.
From the server
directory, use the following commands:
-
Create a new database tables:
npm run migration:new
-
Run all pending migrations:
npm run migration:latest
-
Rollback the last batch of migrations:
npm run migration:rollback
-
Check the status of migrations:
npm run migration:status
-
Unlock stuck migrations:
npm run migration:unlock
- Description: The backend is built with Express.js
- Code Directory:
./server
- Port Mapping:
Externally accessible onhttp://localhost:8000
- Database Integration:
The backend connects to the PostgreSQL database using Knex.js for query operations. - Environment Variables:
NODE_ENV=development
DB_CONNECTION_URI=postgres://infisical:infisical@localhost/infisical?sslmode=disable
- Description: The frontend is a React.js application.
- Code Directory:
./client
- Port Mapping:
Externally accessible onhttp://localhost:3000
- Description: The database is PostgreSQL, used to store and manage persistent data.
- Image:
postgres:16-alpine
- Port Mapping:
Externally accessible onlocalhost:5432
- Query Builder:
Knex.js is used to manage migrations and queries in the backend. - Credentials:
- Username:
infisical
- Password:
infisical
- Database Name:
infisical
- Username:
- Volume:
Data is persisted in thepostgres-data
volume.
- Description: A web-based management tool for PostgreSQL. This will help you quickly view your DB tables.
- Port Mapping:
Accessible onhttp://localhost:5050
- Default Credentials:
- Email:
[email protected]
- Password:
pass
- Email:
- Description: If you are adding any SMTP functionality and need to test sending/receiving emails, use this service.
- Port Mapping:
- SMTP:
localhost:1025
- Web UI:
http://localhost:8025
- SMTP:
Service | URL |
---|---|
Frontend | http://localhost:3000 |
Backend | http://localhost:8000 |
PostgreSQL | localhost:5432 (via psql or client tools) |
pgAdmin | http://localhost:5050 |
SMTP Web UI | http://localhost:8025 |
cd client && npm install
cd ../server && npm install
docker compose -f docker-compose.dev.yml up --build
docker compose -f docker-compose.dev.yml down
Default Ports
- Frontend (React): 3000
- Backend (Express): 8000
- PostgreSQL: 5432
- SMTP dev server: 1025