This is a minimal, production-ready JavaScript backend server template built with Express.js. It provides a clean starting point for building RESTful APIs with modern JavaScript (ES modules) and essential middleware configurations.
- 🚀 Express 5.x - Latest version of the popular Node.js framework
 - 📦 ES Modules - Modern JavaScript module system
 - 🔒 Security - Pre-configured with Helmet.js for security headers
 - 🌐 CORS - Cross-Origin Resource Sharing enabled
 - 📝 Logging - HTTP request logging with Morgan
 - 🔧 Environment Variables - dotenv configuration
 - 💅 Code Formatting - Prettier configuration included
 - 🔄 Hot Reload - Nodemon for development
 - ☁️ Vercel Ready - Deployment configuration included
 
focusapi-template/
├── src/
│   ├── app.js          # Express app configuration and middleware
│   ├── server.js       # Server entry point (create this for local dev)
│   └── public/         # Static files
│       └── index.html  # Welcome page
├── .gitignore          # Git ignore rules
├── .prettierrc         # Code formatting rules
├── package.json        # Dependencies and scripts
├── vercel.json         # Vercel deployment config
└── README.md           # This file
- Node.js (v14 or higher recommended)
 - npm or yarn
 
- Clone the repository:
 
git clone https://github.com/FocusoftHQ/focusapi-template.git
cd focusapi-template- Install dependencies:
 
npm install- Create a 
.envfile in the root directory (optional): 
touch .env- Create 
src/server.jsand populate it with this code snippet: 
import app from './app.js' // ✅ Correct path to API
const PORT = process.env.PORT || 5001
app.listen(PORT, () => {
    console.log(`🚀 Server running locally at http://localhost:${PORT}`)
})- Run 
npm run dev 
npm start- Start the production servernpm run dev- Start development server with hot reloadnpm run format- Format code with Prettiernpm test- Run tests (not configured yet)
Create a .env file in the root directory. Example variables:
PORT=5001
NODE_ENV=developmentGET /- Serves the welcome page- Add your custom routes in 
app.js 
The application comes pre-configured with:
- express.json() - Parse JSON request bodies
 - cors() - Enable CORS (currently allows all origins)
 - helmet() - Security headers
 - morgan('dev') - HTTP request logging
 - Error Handler - Centralized error handling middleware
 
This template is configured for easy deployment to Vercel:
- Install Vercel CLI: 
npm i -g vercel - Run: 
vercel - Follow the prompts
 
The vercel.json configuration is already set up to:
- Build from 
src/app.js - Route all requests through the Express app
 
Feel free to submit issues and enhancement requests!
Interesting read on prettier config: https://www.benpickles.com/articles/80-my-prettier-preferences-and-why