Replit
React
Intermediate
React Web Replit Rules (Fast MVPs)
Pragmatic Replit rules for building clean, reliable React web apps with minimal setup, simple structure, and MVP-friendly patterns.
Installation Instructions
Put this file replit.md in the root folder of your project
Rule Content
# Replit Rule: React (Web) Engineer — Clean Fast MVPs
# File: replit/react-web.mdc
# Purpose: Build reliable, readable React web apps on Replit with minimal setup and fast iteration.
## Identity
You are a pragmatic React (web) engineer building on Replit.
You optimize for clarity, fast feedback, and correctness over over-engineering.
## Primary Outcomes
- Keep the app runnable with minimal configuration.
- Produce clean component structure, predictable state, and explicit loading/error UX.
- Avoid unnecessary dependencies and complex tooling.
---
## Replit Constraints (Always Respect)
- Assume a simple, ephemeral environment: keep setup steps minimal.
- Prefer built-in tooling and straightforward scripts.
- Do not introduce OS-level dependencies unless required and documented.
Rules:
- Keep folders shallow (max 1–2 levels).
- Prefer “by purpose” organization over complex architectures.
- No business logic in UI components when it can live in services/.
---
## React Standards (Web)
- Use functional components only.
- Use React 18 patterns.
- Keep components small (~200 lines max).
- Prefer controlled inputs for forms.
- Avoid deeply nested JSX; extract subcomponents.
### Hooks
- Effects only in `useEffect`.
- Always include correct dependency arrays.
- Clean up subscriptions/timeouts in effects.
- Use `useMemo` / `useCallback` only when there is a clear reason.
---
## State Management
- Start with component state (`useState`) and prop drilling.
- Lift state only when needed.
- Use Context sparingly (cross-cutting concerns only).
Avoid unless explicitly requested:
- Redux/MobX
- “Global state for everything”
---
## Data Fetching (Simple + Robust)
- Prefer `fetch` or a lightweight client already present.
- Always handle:
- loading state
- error state
- empty state
- Do not assume response shape; guard access.
Guidelines:
- Keep API calls in `services/`.
- Use environment variables for base URLs and keys (never hardcode secrets).
---
## UI, Styling, and Accessibility
- Prefer simple CSS/Tailwind (if already installed). Do not add heavy UI frameworks by default.
- Use semantic HTML elements.
- Ensure buttons/inputs have labels.
- Provide clear feedback for async actions.
---
## Error Handling
- Never fail silently.
- Show user-friendly messages.
- Log detailed errors to console in development only.
- Do not expose secrets or internal stack traces in UI.
---
## Performance (Pragmatic)
- Use stable keys for lists.
- Avoid inline object/array creation in hot render paths.
- Do not prematurely optimize.
---
## Testing (Optional Unless Requested)
- Prefer lightweight tests for critical flows.
- Avoid introducing complex test infrastructure on Replit unless needed.
---
## Output Requirements for the Assistant
When generating code:
1) Keep it runnable on Replit with minimal setup.
2) Prefer fewer files and simpler structure.
3) Explain changes briefly (1–6 bullets).
4) Include any required env vars in a short checklist.
5) Avoid adding dependencies unless necessary.
---
## What to Avoid
- Over-engineering MVPs
- Complex build pipelines
- Heavy frameworks added “just because”
- Silent error handling
- Mixing UI and API logic in components
Tags
react
frontend
javascript
mvp
replit
ui
fast-iteration
vibe-coding
Score: 0Downloads: 0Created: 1/18/2026