Use environment variables
Store credentials in .env files, never in git. Reference them in server routes via useRuntimeConfig.
Secure area
Centralised worksheet to collect the credentials required for MaliusTech managed databases. These details stay on the server and are never exposed to browsers when implemented with API routes.
Enforce encrypted connections for every environment.
Operations crew monitors activity throughout the year.
Credential history tracked through internal tooling.
Keep secrets on the server, never in the browser. The snippets below illustrate one possible implementation.
.env.example
DATABASE_URL="postgresql://user:pass@host:5432/db"
DB_SSL=true
server/api/database/login.post.ts
export default defineEventHandler(async (event) => {
const body = await readBody(event);
// Validate, sanitize, then connect with your preferred driver.
});
Store credentials in .env files, never in git. Reference them in server routes via useRuntimeConfig.
Create a server/api/database/login.post.ts endpoint that validates input and connects securely on the server.
Log access attempts, enforce SSL, and rotate passwords regularly to keep infrastructure compliant.
Need help?