This project is intended to managed as a monorepo using PNPM package manager.
The structure of this monorepo is app centric having apps/
folder to keep deployable applications while packages/
folder to keep shared libraries.
.
├── apps/
│ └── server
├── packages
│ ├── data-model
│ └── data-provider
- Lectern Dictionary Management and validation
- Postgres Database For data storage
- PNPM Project manager
- Node.js Runtime environment (v20 or higher)
- VS Code As recommended code editor. Plugins recommended: ESLint, Prettier - Code formatter, Mocha Test Explorer, Monorepo Workspace
To set up this project locally, follow these steps from the root folder.
-
Install Dependencies:
Run the following command to install all necessary dependencies:
pnpm i
-
Build the Workspace:
Use the following command to build the entire workspace:
pnpm build:all
-
Set Environment Variables:
Refer to the Environment Variables section to configure the required environment variables.
-
Start the Server in Development Mode:
Once the build is complete, start the server in development mode using the command described in the Script Commands section:
pnpm start:dev
By default, the server runs on port 3030.
-
Interact with API Endpoints:
A Swagger web interface is available to interact with the API endpoints. Access it at http://localhost:3030/api-docs/.
Create a .env
file based on .env.schema
located on the root folder and set the environment variables for your application.
The Environment Variables used for this application are listed in the table bellow
Name | Description | Default |
---|---|---|
AUDIT_ENABLED |
Ensures that any modifications to the submitted data are logged, providing a way to identify who made changes and when they were made. | true |
DB_HOST |
Database Hostname | |
DB_NAME |
Database Name | |
DB_PASSWORD |
Database Password | |
DB_PORT |
Database Port | |
DB_USER |
Database User | |
ID_CUSTOM_ALPHABET |
Custom Alphabet for local ID generation | '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
ID_CUSTOM_SIZE |
Custom size of ID for local ID generation | 21 |
ID_USELOCAL |
Generate ID locally | true |
LECTERN_URL |
Schema Service (Lectern) URL | |
LOG_LEVEL |
Log Level | 'info' |
PORT |
Server Port. | 3030 |
UPLOAD_LIMIT |
Limit upload file size in string or number. Supported units and abbreviations are as follows and are case-insensitive: - b for bytes - kb for kilobytes - mb for megabytes - gb for gigabytes - tb for terabytes - pb for petabytes Any other text is considered as byte |
'10mb' |
Command | Description |
---|---|
pnpm build:all |
Compile typescript code in the workspace and generate database schemas |
pnpm start:dev |
Run database migration and start Server for development |
pnpm start:prod |
Run database migration and start Server for production |