Skip to content

BouyguesTelecom/static.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ StaticJS

A modern React boilerplate for creating static projects

npm version License: MIT Node.js Version

Start your static projects in seconds with an optimized architecture

Installation β€’ Usage β€’ Features β€’ Examples

πŸ“– Table of Contents

🎯 About

StaticJS is a powerful and modern boilerplate designed for creating static projects. It integrates development best practices and offers advanced features like specific page revalidation.

Why StaticJS?

  • ⚑ Ultra-fast startup - Initialize your project in seconds
  • πŸ”„ Smart revalidation - Rebuild specific pages on demand
  • πŸ—οΈ Modern architecture - Optimized and maintainable project structure
  • πŸš€ Production ready - Production-ready configuration
  • πŸ“± Responsive - Native support for all devices

✨ Features

Feature Description
πŸš€ Fast generation Project creation with a single command
πŸ”„ WebSocket Hot Reloading Real-time WebSocket-based development reloading
πŸ“¦ Optimized build Production-optimized bundle
🎯 Targeted revalidation Specific page reconstruction via API
πŸ› οΈ Flexible configuration Advanced customization according to your needs
πŸ“Š Performance Automatic performance optimizations

πŸš€ Installation

Prerequisites

  • Node.js >= 16.0.0
  • npm >= 7.0.0

Global installation

npm i @bouygues-telecom/staticjs -g

πŸ’‘ Tip: Global installation allows you to use the create-staticjs-app command from anywhere on your system.

πŸ“˜ Usage

1. Create a new project

create-staticjs-app

This command will:

  • πŸ“ Create the folder structure
  • βš™οΈ Configure base files
  • πŸ“¦ Prepare the development environment

2. Install dependencies

cd your-project
npm i

3. Build & Start the server

npm run start

πŸŽ‰ Your project is now accessible at http://localhost:3300

πŸ”„ Revalidation

StaticJS offers a unique targeted revalidation feature that allows rebuilding specific pages without rebuilding the entire project.

Basic syntax

curl -X POST http://localhost:3000/revalidate \
  -H "Content-Type: application/json" \
  -d '{ "paths": ["page.tsx"] }'

πŸ“š Examples

Revalidate a single page

curl -X POST http://localhost:3000/revalidate \
  -H "Content-Type: application/json" \
  -d '{ "paths": ["home.tsx"] }'

Revalidate multiple pages

curl -X POST http://localhost:3000/revalidate \
  -H "Content-Type: application/json" \
  -d '{ "paths": ["home.tsx", "about.tsx", "contact.tsx"] }'

βš™οΈ Configuration

Project structure

your-project/
β”œβ”€β”€ πŸ“ src/
β”‚   β”œβ”€β”€ πŸ“ pages/          # Your pages
β”‚   β”œβ”€β”€ πŸ“ components/     # Reusable components
β”‚   β”œβ”€β”€ πŸ“ styles/         # Style files
β”‚   └── πŸ“ utils/          # Utilities
β”œβ”€β”€ πŸ“ public/             # Static assets
β”œβ”€β”€ πŸ“„ package.json
└── πŸ“„ server.js           # StaticJS server

πŸ› οΈ Available scripts

Script Description
npm run build Build the project for production
npm run start Start the production server

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for more details.


Developed with ❀️ by the Bouygues Telecom team

About

Transform your React app into minimalist static files πŸš€

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •