Services required by TPEN interfaces in order to interact with data.
Open API: TPEN Services provides a public API with an open CORS policy, accessible from any origin without restrictions.
-
Install dependencies
npm install
-
Configure environment
# Copy the development template cp .env.development .env # Edit .env with your specific values: # - Add your GitHub token (GITHUB_TOKEN) # - Set your Auth0 credentials (AUDIENCE, DOMAIN) # - Adjust other settings as needed
-
Start the development server
npm run dev
The service will be available at
http://localhost:3011
TPEN Services uses a layered configuration approach with --import ./env-loader.js using the dotenv package:
-
config.env- Safe defaults, committed to repository- Works out-of-the-box for local Docker/MongoDB/MariaDB
- Contains no secrets
- Provides sensible defaults for development
-
.env.development- Development environment template- Copy this to
.envfor local development - Contains placeholders for secrets
- Can be committed (no actual secrets)
- Copy this to
-
.env.production- Production environment template- Template for production deployments
- All secrets should be replaced with actual values
- Never commit actual production secrets
-
.env- Your local configuration (gitignored)- Created by copying a template
- Contains your specific settings and secrets
- Overrides values from
config.env
Configuration is loaded via --import ./env-loader.js using the dotenv package:
config.envis loaded first (provides safe defaults).env.{NODE_ENV}is loaded second (environment-specific: .env.development, .env.production, .env.test).envis loaded last (local/server overrides - HIGHEST PRIORITY)
Key variables you'll need to set in .env:
GITHUB_TOKEN- GitHub Personal Access Token for static storageAUDIENCE- Auth0 API audienceDOMAIN- Auth0 tenant domainMONGODB- MongoDB connection string (if different from default)MARIADB- MariaDB host (if different from default)
See CONFIG.md for complete configuration documentation.
# Run all tests
npm run allTests
# Run specific test suites
npm run unitTests # Core unit tests
npm run existsTests # Route/class validation
npm run E2Etests # End-to-end API tests
npm run dbTests # Database testsFor production deployments:
- Copy
.env.productionto.env - Replace all
REPLACE_WITH_SECRETplaceholders with actual secrets - Use GitHub Secrets or environment variables for sensitive values
- Never commit production secrets to the repository
See CONFIG.md for detailed deployment instructions.