# SolidJS

A SolidJS 1.9 single-page app starter in strict TypeScript, built with Vite 7 and Solid Router, for developers who want fine-grained reactivity in a ready project. It includes a shared layout, Home, About and 404 pages, CSS Modules, ESLint, tsc type checking and Vitest with Solid Testing Library.

- Framework: SolidJS (JavaScript)
- Category: Starters / Single-page apps
- Creates: a static site
- Plan: Free
- Price: Free
- Author: Light Cloud
- Page: https://templates.light-cloud.com/starters/single-page-apps/solidjs-vite-starter
- Updated: 2026-11-21

## Features

- Solid Router with / (a createSignal counter), /about and a catch-all 404; About and 404 are lazy-loaded
- One Layout component (header, navigation, footer) as the router root
- TypeScript in strict mode, with pnpm typecheck running tsc --noEmit
- A typed VITE_APP_TITLE build-time variable declared in src/env.d.ts, with an .env.example
- CSS Modules per component, design tokens and base styles in src/styles/global.css
- ESLint flat config with typescript-eslint and eslint-plugin-solid
- Vitest with Solid Testing Library and user-event, plus solid-devtools in development
- Dev server on port 3000, set in vite.config.ts

## What you need

- Free plan: it builds to a static site, which the Free plan hosts with no limit on sites
- To run it locally: Node.js 22.12 or later and pnpm (npm also works)
- No API keys: it starts with nothing to configure

## About

Solid compiles JSX into direct DOM updates, so a signal change updates only the text that reads it, with no virtual DOM diffing. The starter pairs that with strict TypeScript and typed environment variables, so mistakes show up in your editor and in pnpm typecheck. Start by editing src/pages/Home.tsx and adding pages to the route table in src/App.tsx. Deploying runs the build script and serves dist/ from a CDN, with unknown paths falling back to index.html for Solid Router.

## Questions

### How do I add a new page to a SolidJS app with Solid Router?

Create a component in src/pages/, add a Route for it inside the Router in src/App.tsx (wrap it in lazy() to load it on demand), and add an A link in src/components/Layout.tsx.

### How do I add a typed environment variable in SolidJS with Vite?

Add it to .env.local with a VITE_ prefix, declare it in src/env.d.ts, and read it with import.meta.env. Values are fixed at build time, so never put secrets in them.

### Can I use npm instead of pnpm for this SolidJS starter?

Yes. npm install and npm run dev use the same scripts. npm creates its own package-lock.json; delete pnpm-lock.yaml if you switch for good.

### Why does my Solid Router page show a 404 after refreshing?

The host is looking for a file at that path and finds none. Configure it to serve index.html for unknown paths; Light Cloud does this for you.

### Can I host this SolidJS template without Light Cloud?

Yes. Run pnpm build and serve dist/ from any static host, such as Netlify, Cloudflare Pages or nginx, with a fallback to index.html for client-side routes.
