Skip to main content

Environment & Configuration

All runtime configuration lives in a single .env file at the project root. The scaffold ships with an .env.example; copy it to .env and edit.

Variables

Database

VariableDefaultNotes
DATABASE_HOSTlocalhost
DATABASE_PORT5432
DATABASE_USERNAME(set at scaffold)
DATABASE_PASSWORD(set at scaffold)
DATABASE_NAME(set at scaffold)

These are read by both the API runtime (MarketlumCoreModule) and the TypeORM CLI (data-source.ts).

Authentication

VariableDefaultNotes
JWT_SECRETchange-me-in-productionMust be changed before deploying
JWT_EXPIRES_IN1dStandard jsonwebtoken duration

Ports and URLs

VariableDefaultNotes
API_PORT3001
WEB_PORT3000
NEXT_PUBLIC_WEB_URLhttp://localhost:3000Used by API CORS allowlist

File storage

VariableDefaultNotes
STORAGE_DRIVERlocalSet to s3 to use the S3 provider
S3_BUCKETRequired when STORAGE_DRIVER=s3
S3_REGION
AWS_ACCESS_KEY_IDOr use IAM role
AWS_SECRET_ACCESS_KEY

When STORAGE_DRIVER is unset or local, uploads land in ./uploads at the project root.

Custom storage provider

If you need a storage backend other than local disk or S3 (e.g. GCS, Azure Blob), implement the StorageProvider interface and bind it in your API module.

apps/api/src/gcs-storage.provider.ts
import { Readable } from 'stream';
import type { StorageProvider, StorageDownloadResult } from '@marketlum/core';

export class GcsStorageProvider implements StorageProvider {
async upload(key: string, buffer: Buffer): Promise<void> { /* ... */ }
async download(key: string): Promise<StorageDownloadResult> { /* ... */ }
async delete(key: string): Promise<void> { /* ... */ }
}
apps/api/src/app.module.ts
import { MarketlumCoreModule, STORAGE_PROVIDER } from '@marketlum/core';
import { GcsStorageProvider } from './gcs-storage.provider';

@Module({
imports: [ConfigModule.forRoot({ isGlobal: true, envFilePath: '../.env' }), MarketlumCoreModule],
providers: [
{ provide: STORAGE_PROVIDER, useClass: GcsStorageProvider },
],
})
export class AppModule {}

NestJS' last-binding-wins rule means your provider supersedes the one registered inside MarketlumCoreModule.

Custom configuration

For values that aren't in .env (feature flags, third-party API keys), use NestJS' ConfigModule and inject ConfigService into your own modules. Don't edit @marketlum/core to read new env vars — read them in your own code instead.