| name | replit-performance-tuning |
| description | Optimize Replit app performance: cold start, memory, Nix caching, and deployment speed.
Use when experiencing slow startup, high memory usage, deployment timeouts,
or optimizing Replit container resource usage.
Trigger with phrases like "replit performance", "optimize replit",
"replit slow", "replit cold start", "replit memory", "replit startup time".
|
| allowed-tools | Read, Write, Edit |
| version | 1.12.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","replit","performance","optimization"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Replit Performance Tuning
Overview
Optimize Replit app performance across the entire lifecycle: cold start reduction, Nix environment caching, build speed, runtime memory management, and deployment configuration. Replit containers have resource limits — efficient usage is critical.
Prerequisites
- Replit app deployed or running in Workspace
- Understanding of
.replit and replit.nix
- Access to deployment monitoring
Instructions
Step 1: Reduce Cold Start Time
Autoscale deployments scale to zero when idle. First request triggers a cold start (10-30s). Minimize it:
import { heavyAnalytics } from './analytics';
import { imageProcessor } from './images';
app.get('/api/analyze', async (req, res) => {
const { heavyAnalytics } = await import('./analytics');
res.json(await heavyAnalytics.process(req.query));
});
let dbPool: Pool | null = null;
function getDB(): Pool {
if (!dbPool) {
dbPool = new Pool({
connectionString: process..,
: { : },
: ,
});
}
dbPool;
}
app = ();
= (process.. || );
app.(, , {
.();
().(.);
});
() {
().();
}