Hey devs ๐,
Iโve been building full-stack apps for years, and one thing always annoyed me:
Why are we still manually setting up proxies, fixing CORS, remembering build folders, and running two serversโฆ just to connect a frontend and backend?
So I built a solution.
โก express-auto-frontend โ Zero-Config Frontend + Express Integration
This small library automatically connects any modern frontend (React, Vite, Vue, Angular, Svelte, Nuxt, or even static HTML) to your Express backend โ in both development and production.
๐ No proxy configs
๐ No CORS issues
๐ No remembering build paths
๐ No custom scripts
๐ No double-server headaches
Just one line:
include(app, '../frontend');
โฆand everything works.
๐ฏ Why I Built It
I kept seeing the same frustrations:
- Frontend on 5173, backend on 3001
- Vite proxy issues
- Random CORS errors
- Different dev vs production setups
- Confusing deployment steps
I wanted something that just works, with one unified URL during development and a clean production flow.
Now it does.
๐ก What It Automatically Handles
โ Development Mode
- Detects your frontend framework
- Starts the frontend dev server automatically
- Proxies
/api/*requests to Express - Sends all other routes to the frontend dev server
- Full HMR support
- Eliminates CORS completely
- One single origin for the entire stack
โ Production Mode
- Detects your
dist/buildfolder - Serves the optimized frontend build
- Handles SPA routing (
index.htmlfallback) - Express continues serving your API normally
Zero config. Zero stress.
๐งช Example (Complete App in 20 Seconds)
const express = require('express');
const include = require('express-auto-frontend');
const app = express();
const PORT = 3001;
app.get('/api/message', (req, res) => {
res.json({ message: 'Hello from the backend!' });
});
include(app, '../frontend');
app.listen(PORT, () =>
console.log(`Server running at http://localhost:${PORT}`)
);
Thatโs literally all you need.
๐ Supported Frameworks
- React (Vite + CRA)
- Vue (CLI + Nuxt)
- Angular
- Svelte / SvelteKit
- Static HTML or Pug
๐ฆ NPM
npm i express-auto-frontend
Package: express-auto-frontend
Current version: 1.0.2
Published: 15 hours ago
โค๏ธ Final Words
I built this because full-stack development should feel smooth, not painful.
If youโre tired of manually setting up proxies, fighting CORS, and juggling two servers, give it a try.
If you want to reach out, collaborate, or share feedback, contact me at:
๐ฉ silivestirassey@gmx.com
Happy hacking! โก
โ Silivestir / splannes
Top comments (0)