惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
雷峰网
雷峰网
S
SegmentFault 最新的问题
博客园 - 【当耐特】
博客园_首页
量子位
爱范儿
爱范儿
博客园 - 叶小钗
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
V
V2EX
美团技术团队
V
Visual Studio Blog
博客园 - 三生石上(FineUI控件)
IT之家
IT之家
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
博客园 - 聂微东
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog
宝玉的分享
宝玉的分享
WordPress大学
WordPress大学
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Hardening a Replit AI MVP for Production
Alex Natskovich · 2026-06-17 · via DEV Community

Alex Natskovich

A vibe-coded Replit app can survive a demo.

Production asks different questions.

What happens when two users hit the same endpoint? Can one user read another user's records? Are Stripe live keys separated from test keys? What stops an LLM call from looping until the bill hurts?

Before you share the link outside your team, harden the app around a few boring files and rules.

Boring is good here.

1. Start with replit.md

Replit's agent needs persistent instructions. Without them, each prompt session can drift from earlier decisions.

Create a replit.md file and treat it like a small production contract.

# Production rules

## Security
- Every API endpoint must check authentication.
- Every user-owned resource must check authorization.
- Never expose secrets in client-side code.
- Do not create public endpoints unless explicitly requested.

## Database
- Use migrations for schema changes.
- Do not modify production data directly.
- Keep dev, staging, and production databases separate.

## Input validation
- Validate request body fields.
- Set file size limits on uploads.
- Reject unsupported file types.

## External services
- Add rate limits for paid APIs.
- Add spending caps where the provider supports them.
- Log failed webhook events.

## Code changes
- Do not rewrite unrelated functions while fixing a bug.
- Change only the affected files unless asked.

This does not repair weak code already generated. It does reduce new damage.

2. Find Replit assumptions before migration

A Replit prototype often depends on things you forgot were Replit-specific: secrets, URLs, storage, process behavior, or a bundled database.

Start with a basic search.

grep -R "replit" .
grep -R "localhost" .
grep -R "process.env" ./src
grep -R "sqlite" .
grep -R "uploads" .

Then check your runtime setup.

const port = process.env.PORT || 3000;

app.listen(port, "0.0.0.0", () => {
  console.log(`Server running on port ${port}`);
});

If the app only runs inside the Replit workspace, it is still a prototype.

3. Move secrets into explicit env config

Do not migrate until you can describe every required variable.

DATABASE_URL=
SESSION_SECRET=
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=
OPENAI_API_KEY=
SENTRY_DSN=
APP_ENV=development

Commit the example file.

touch .env.example
git add .env.example
git commit -m "Document required environment variables"

Never commit the real .env.

.env
.env.local
.env.production

Ouch if this is missing. Fix it early.

4. Test authorization at the API layer

AI-built apps often make login look finished while leaving the API too trusting.

The UI is not the security boundary.

app.get("/api/invoices/:id", async (req, res) => {
  const session = await getSession(req);
  const invoice = await getInvoice(req.params.id);

  if (!session) {
    return res.status(401).json({ error: "Unauthorized" });
  }

  if (invoice.userId !== session.user.id) {
    return res.status(403).json({ error: "Forbidden" });
  }

  return res.json(invoice);
});

Then test the bad path.

curl -H "Authorization: Bearer USER_A_TOKEN" \
  https://example.com/api/invoices/USER_B_INVOICE_ID

Expected result:

403 Forbidden

If you get invoice data back, stop adding features.

5. Add limits before real users arrive

Your app needs limits around uploads, paid APIs, and LLM calls.

Example upload guard:

const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10 MB

if (file.size > MAX_FILE_SIZE) {
  return res.status(413).json({
    error: "File exceeds 10 MB limit",
  });
}

Example AI usage guard:

if (user.monthlyTokensUsed >= user.monthlyTokenLimit) {
  return res.status(429).json({
    error: "Monthly AI usage limit reached",
  });
}

Example route-level rate limit:

import rateLimit from "express-rate-limit";

export const apiLimiter = rateLimit({
  windowMs: 60 * 1000,
  limit: 60,
});

Attach it before the expensive route.

app.post("/api/generate", apiLimiter, generateHandler);

Small guardrails save large invoices.

6. Split environments before public testing

Use three separate environments, even if the app is small.

local      -> local database
staging    -> staging database
production -> production database

A minimal CI workflow is enough to start.

name: ci

on:
  pull_request:
  push:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 20

      - run: npm ci
      - run: npm run lint
      - run: npm test

Add smoke tests for login, checkout, upload, and any AI flow that costs money.

7. Know when to bring in help

You can keep hardening the app yourself while the risk is low.

Bring in engineering help when one bad prompt could expose user data, trigger live payments, corrupt production data, or break a workflow customers depend on.

MEV is one vendor option for that stage. Their Vibe-Code to Production work is built around auditing Replit, Lovable, and AI-built MVPs, then hardening auth, secrets, AI integrations, observability, infrastructure, and deployment without forcing an automatic rewrite.

Useful fit:

  • you have a working Replit prototype
  • users, money, or sensitive data are involved
  • the agent keeps breaking working features
  • integrations are half-finished
  • you need a rebuild-vs-refactor call before launch

Quick checklist

Before sharing the production URL, confirm this:

  • replit.md has production rules
  • company owns the repo
  • .env.example exists
  • secrets are out of code
  • auth is checked on every API endpoint
  • user-owned records have authorization checks
  • uploads have size and type limits
  • paid APIs have rate limits
  • LLM calls have usage caps
  • staging and production use separate databases
  • CI runs before deploy
  • errors are logged somewhere you check

A Replit MVP is a strong starting point.

Production needs stricter rules, fewer hidden assumptions, and a path back when something breaks.

Full original guide: https://mev.com/blog/how-to-get-a-vibe-coded-replit-app-production-ready

MEV production-hardening service: https://mev.com/services/vibe-code-to-production