This is my audit prompt. The bullets in the bottom section are clearly related to my specific app - you would need to rewrite these to be a list of things important to your project. Top tip: get agent to help you write these!
## **Replit Compliance Audit + Fix Prompts**
Please review the entire project codebase and perform a **compliance audit** against the architecture and guardrails below. **Only provide the report** at this time — do **not** make any changes until instructed.
Your response must include the following two outputs:
---
### PART 1: Compliance Summary
Output a **simple bullet list**, grouped into two sections:
#### Conforms to Architecture
* \[Bullet points referencing specific files, logic, patterns, or behaviors that match the expected architecture]
#### Violates Architecture
* \[Bullet points describing any violations, misconfigurations, or security concerns]
* Where applicable, reference filenames, function names, and line numbers
* Focus on: architecture violations, security risks, Supabase misuse, environment variable exposure, or direct SQL execution
---
### PART 2: Repair Prompts
Based on the issues found, output a **series of fix prompts** that the user can paste back into Replit to repair the project.
Format like this:
#### Fix Group 1: \[Succinct title, e.g. "Frontend calls Supabase directly"]
* **Prompt to fix**: \[Pasteable Replit prompt]
#### Fix Group 2: \[e.g. "JWT not verified in dashboard route"]
* **Prompt to fix**: \[Pasteable Replit prompt]
...
Please:
* Group related issues into a single fix prompt
* Separate unrelated fixes into their own sections
* Order prompts by priority: **security and architecture first**, cleanup last
* Do not repeat the same fix in multiple groups — consolidate cleanly
---
### Architecture Guardrails
1. The **frontend must never access Supabase directly** — including for auth or session data.
2. All Supabase usage (auth, database, file storage) must occur **only in the backend**, using `@supabase/supabase-js`. The service role key must be used for all database and storage operations. The anon key is permitted only for **sessionless authentication functions** (`signUp`, `signInWithPassword`, `resend()`, password reset, etc.) and must be isolated in a dedicated auth client to prevent RLS contamination.
3. The frontend must communicate **only with the backend** via API routes using `VITE_BACKEND_URL`.
4. Do **not use** `pg`, `drizzle`, `prisma`, or any direct database drivers or ORMs.
5. All file uploads must be routed through the backend and stored in **Supabase storage buckets**.
6. Backend APIs must issue **signed JWTs on login**, and all protected routes must verify the JWT.
7. Supabase keys, SMTP credentials, and other environment secrets must **never be exposed in frontend code or Vite-visible `.env` files**.
8. Project must have a clear and consistent **client/server directory split** (e.g., `/src` for frontend, `/server` for backend).
9. Do **not run Supabase SQL automatically** — all SQL (for tables, policies, triggers) must be **output for manual pasting into Supabase**.
10. **RLS enforcement must be in place** on all Supabase tables, including:
* Authenticated-user-only access:
* `SELECT`, `UPDATE`, and `INSERT` policies using `auth.uid() = id`
* Role-based `SELECT` access for admins (`role = 'admin'`)
* Explicit `service_role` bypass policies for all operations (`SELECT`, `INSERT`, `UPDATE`, `DELETE`)
* Proper **dual-client architecture**:
* `auth client` using the **anon key**, isolated to sessionless auth tasks (`signUp`, `signInWithPassword`, etc.)
* `admin client` using the **service role key** for all other DB/storage operations
* Ensure no contamination: **do not** reuse the auth client for database queries
11. All backend files must use consistent ES module syntax (`import`/`export`). CommonJS patterns like `require()` or `module.exports` must not be used in any `.ts` or `.js` files. Mixed imports within the same file are not permitted.
12. Advise of any environment variables used in the app that have not yet been defined in the secrets tool
13. Verify no forbidden dependencies are present: check for `drizzle`, `prisma`, `pg` packages in package.json and ensure no related config files exist (drizzle.config.ts, prisma.schema, etc.)
14. The **frontend must never access Supabase file storage directly** - it should use a backend proxy route that uses the admin Supabase client for storage operations to retrieve files and serve them through the backend API, avoiding any direct frontend storage access