Where to keep API keys instead of .env files: Infisical
Short answer: keep API keys in a secrets manager, not in .env files shared over chat or committed to a repository. Infisical is an open-source option: it stores secrets per project and environment, hands them to apps and CI with a CLI or SDK, and records who read or changed each one. The Tracklayer template runs Infisical on Railway with Postgres, Redis, generated keys and an admin account created for you.
When this makes sense
A .env file works for one developer. It breaks down when a second person, a CI pipeline and a production server all need the same keys: copies drift, old keys linger and nobody knows who has what. AI-built apps tend to need several provider keys, which makes the problem larger.
Uses listed in the template documentation:
- replacing
.envfiles shared over chat with per-environment secrets and access control, - injecting secrets into Railway services, Docker builds and CI pipelines with the Infisical CLI,
- syncing secrets to cloud providers and Kubernetes through integrations,
- auditing who read or changed a secret, and rotating credentials on a schedule.
A secrets manager is itself a sensitive service. Self-hosting means you own its backups and updates. Consider whether a hosted option fits your risk level better.
What the template deploys
| Service | Role |
|---|---|
| Infisical | Web UI and API on the public domain; migrations run in a pre-deploy step |
| Postgres 18 | Encrypted secrets and audit logs, on a volume |
| Redis 8.2 | Cache and job queues, on a volume |
| Infisical Bootstrap | One-shot job that creates the super-admin and first organization, then exits |
The bootstrap job matters on a secrets manager. A fresh Infisical instance lets the first visitor become super-admin. The job claims the instance with your email as soon as the server is healthy, so nobody else can register first. Postgres and Redis have no public TCP proxies.
Deploy it, step by step
- Use the Hobby plan or higher. The Infisical service runs close to Trial’s 1 GB per-service limit at idle, according to the template notes.
- Enter your email in
INFISICAL_ADMIN_EMAIL. It is the only required input; keys and passwords are generated. - Wait for Infisical Bootstrap to log that the instance is bootstrapped.
- Sign in at your Infisical domain with that email and
INFISICAL_ADMIN_PASSWORDfrom the Infisical Bootstrap variables. Change the password and enable MFA. - Back up
ENCRYPTION_KEYfrom the Infisical service variables, somewhere outside Railway. - Invite your team from Organization settings. Optional Google and GitHub sign-in can be enabled through variables.
Using it from your app and CI
Infisical serves a web UI and an API used by its CLI, SDKs and Kubernetes operator. Typical flow: create a project, add environments such as development and production, enter your keys, then have your app or pipeline fetch them with the Infisical CLI instead of reading a file. The template notes also mention that services on Railway can pull secrets over the private network. For exact commands, use Infisical’s own documentation.
Telemetry to Infisical is off by default in this template (TELEMETRY_ENABLED=false).
What it costs
Idle RAM figures were measured locally by the template author. The typical figures and all dollar amounts are estimates, calculated at $10 per GB of RAM, $20 per vCPU and $0.15 per GB of volume per month.
| Load | RAM | Estimated monthly cost |
|---|---|---|
| Idle (measured) | about 1.0 GB | about $11 |
| Typical, team of 20 with CI pulling secrets (estimated) | about 1.35 GB | about $17 |
Infisical keeps no local state, so you can add replicas for API-heavy workloads such as many CI jobs. Scale Postgres vertically.
Limitations and licence notes
- Single point of dependency. If Infisical is down, anything that fetches secrets at start-up may fail to boot. Plan for that before wiring production to it.
- Email. Outbound SMTP needs Railway Pro; see the FAQ.
- Keys.
ENCRYPTION_KEYandAUTH_SECRETare generated once. ChangingAUTH_SECRETsigns everyone out; changingENCRYPTION_KEYwithout the proper procedure makes secrets unreadable. - Licence. See the FAQ. This is not legal advice.
- Community template. Not affiliated with or endorsed by Infisical.
Other options
If your app also needs user login and single sign-on, see the Keycloak guide. For databases and other services behind an AI-built app, see backends for vibe-coded apps. Browse all guides.
FAQ
How do I log in to Infisical after deploying?
Enter your email in INFISICAL_ADMIN_EMAIL when deploying. When the Infisical Bootstrap service logs that the instance is bootstrapped, sign in at your domain with that email and the INFISICAL_ADMIN_PASSWORD value from the Infisical Bootstrap variables. Change the password and enable MFA. Public sign-up is closed after bootstrap; invite your team from the organization settings.
What happens if I lose ENCRYPTION_KEY?
Stored secrets cannot be decrypted, even from a database backup. Copy ENCRYPTION_KEY from the Infisical service variables to a safe place outside Railway. Do not change it without Infisical's key-rotation procedure.
Can Infisical send invitation emails on Railway?
Infisical sends mail over SMTP only, and Railway allows outbound SMTP on the Pro plan. On other plans, share the invitation links shown in the UI. Fill the SMTP_* variables if you are on Pro.
What are the licence terms?
According to the template's NOTICE.md, the Infisical core is MIT. Content under the ee/ directories falls under Infisical's enterprise license; check Infisical's documentation for what that covers. Postgres uses the PostgreSQL License and Redis 8 is offered under RSALv2, SSPLv1 or AGPLv3. The template is a community template, not an Infisical product.
How do I upgrade?
Back up Postgres, change the image tag on the Infisical service and redeploy. Migrations run in the pre-deploy step, and a failed migration leaves the running version untouched.