/replit-tutorials

How to store static files in Replit

Learn how to store and serve static files in Replit with simple steps to organize assets, optimize hosting, and streamline your project setup.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to store static files in Replit

Storing static files in Replit is simple: you put them directly in your Replit project folder, typically inside a folder named public or static, and then you configure your server (Node, Python, etc.) to serve that folder. Replit automatically exposes any file you include in your project — you don’t need a CDN or a special storage service. The main thing to remember is that static files should be checked into your project (NOT stored as secrets and NOT generated in hidden temp directories), and avoid storing extremely large files because Replit storage is limited.

 

What “static files” means in Replit

 

Static files are files that don’t change when your app runs. Examples:

  • Images like logo.png
  • CSS files
  • Client-side JavaScript (React builds, etc.)
  • Fonts

In Replit, these are just normal files you place in folders inside your project. The editor and the host environment both see them the same way.

 

Where to place static files

 

The most common and reliable structure:

  • Create a folder called public or static in the root of your Repl.
  • Put all images, CSS, JS, and other assets in there.
  • Commit them with Git if your Repl uses version control.

Replit doesn’t auto-serve static files on its own; your server must point to that directory (except for pure HTML/CSS/JS Repls where Replit serves everything automatically).

 

Serving static files in Node.js (Express)

 

import express from "express";
const app = express();

// Serve everything in the "public" folder
app.use(express.static("public"));

app.listen(3000, () => console.log("Server running"));
// Any file inside /public can now be accessed by URL.
// Example: public/logo.png => https://your-repl-url/logo.png

 

Serving static files in Python (Flask)

 

Flask automatically serves files inside a folder named static.

from flask import Flask, send_from_directory

app = Flask(__name__)   # Flask uses "./static" automatically

@app.route("/")
def index():
    return "<img src='/static/logo.png'>"

# If you need to manually serve something:
@app.route("/files/<path:path>")
def files(path):
    return send_from_directory("static", path)

app.run(host="0.0.0.0", port=3000)

 

Static files in React/Vite inside Replit

 

If you have a React or Vite app running inside Replit:

  • During development: place assets in public folder or import them normally.
  • When built: Vite outputs to dist. If using a backend, configure your server to serve dist.
app.use(express.static("dist"));  // After you run "npm run build"

 

What NOT to do

 

  • Do NOT store static files in Replit Secrets — those are only for environment variables.
  • Do NOT store static files in hidden temp folders created at runtime; those get deleted.
  • Do NOT store extremely large assets (hundreds of MB). Replit storage is limited and will slow down your Repl.
  • Do NOT rely on Replit Deployments to host huge static bundles; use a CDN if the project grows.

 

When Replit might not be ideal for static files

 

Replit is great for small and medium static assets, but if you need:

  • Large video files
  • CDN-level speed across regions
  • High-traffic bandwidth

…you should store those assets elsewhere (e.g., Cloudflare R2, S3, or a real CDN) and just reference them from your Repl.

 

Summary

 

You store static files in Replit by placing them directly in your project folder (usually public or static), committing them, and configuring your server to serve that folder. Replit doesn’t require special static hosting features — it just serves what your server exposes. Keep file sizes reasonable and avoid storing them anywhere that Replit clears automatically.

Still stuck?
Copy this prompt into ChatGPT and get a clear, personalized explanation.

This prompt helps an AI assistant understand your setup and guide you through the fix step by step, without assuming technical knowledge.

AI AI Prompt

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022