A minimal React starter kit with TypeScript, React Router, a language manager, a theme manager, and a tiny mock API example.
The project is intentionally small. It is meant to be easy to read, easy to extend, and a clean base for new projects.
npm install
npm run devOther commands:
npm run build
npm run lint
npm run preview- React + TypeScript
- React Router base setup
- language handling via React Context
- theme handling via React Context
- persistence with
localStorage - themes with CSS variables
- a small mock API example for loading and fallback states
src/appfor app shell and routersrc/pagesfor pagessrc/contextsfor language and theme statesrc/configfor central app settingssrc/localesfor translation contentsrc/servicesfor API or mock logicsrc/stylesfor global styles, themes, and page CSS
The homepage is only a small preview page. You can replace it at any time.
The most important setup file is:
src/config/app-settings.ts
It contains:
- storage keys
- default language
- default theme
- available languages
- available themes
- switcher labels
Edit src/config/app-settings.ts:
defaults: {
language: 'en-EN',
theme: 'sunrise',
}- Create a new locale file in
src/locales. - Import it in
src/config/app-settings.ts. - Add it to the
languagesarray.
Example:
import { frFR } from '../locales/fr-FR'
languages: [
{
code: 'de-DE',
htmlLang: 'de',
switcherLabel: 'DE',
messages: deDE,
},
{
code: 'en-EN',
htmlLang: 'en',
switcherLabel: 'EN',
messages: enEN,
},
{
code: 'fr-FR',
htmlLang: 'fr',
switcherLabel: 'FR',
messages: frFR,
},
]- Create a new CSS file in
src/styles/themes. - Import it in
src/main.tsx. - Add it to the
themesarray insrc/config/app-settings.ts.
Example config:
themes: [
{
id: 'midnight',
switcherLabel: 'Midnight',
},
{
id: 'sunrise',
switcherLabel: 'Sunrise',
},
{
id: 'forest',
switcherLabel: 'Forest',
},
]Example theme file:
:root[data-theme='forest'] {
--app-bg: #102018;
--app-surface: #163124;
--app-surface-muted: #1d3d2d;
--app-border: rgba(255, 255, 255, 0.08);
--app-text: #edf7ef;
--app-muted: #b7cbbb;
--app-accent: #7fd59a;
--app-accent-contrast: #0d1812;
--app-shadow:
0 24px 60px rgba(0, 0, 0, 0.24),
0 10px 28px rgba(0, 0, 0, 0.16);
}The homepage styles are split into two files:
src/styles/homepage/homepage-layout.cssfor structure and spacingsrc/styles/homepage/homepage-style.cssfor colors and visual styling
src/styles/homepage/homepage.css only imports both files.
src/pages/HomePage.tsxsrc/services/api.tsxsrc/config/app-settings.tssrc/contexts/LanguageContext.tsxsrc/contexts/ThemeContext.tsxsrc/locales/de-DE.tssrc/locales/en-EN.tssrc/styles/global.csssrc/styles/themes/root-midnight.csssrc/styles/themes/root-sunrise.css
This starter kit stays small on purpose.
It prefers:
- simple files over heavy abstraction
- CSS variables over larger theme systems
- React Context over extra state libraries
- one central config over scattered setup
If your project grows, you can build on top of it. The foundation should still stay clear and easy to understand.