This is a boilerplate project designed for quickly starting new web applications using Preact, Hono, and Server-Side Rendering (SSR).
- Preact: A fast, lightweight alternative to React, perfect for performance-sensitive applications.
- Hono: An ultra-fast web framework for Cloudflare Workers, Deno, Bun, Node.js, and more. It simplifies routing and middleware.
- Server-Side Rendering (SSR): Improves initial page load performance and SEO by rendering pages on the server.
- Vite: A fast and opinionated build tool that provides blazing fast HMR during development.
- Vanilla Extract: Type-safe CSS-in-JS for predictable and maintainable styling.
- CSS Reset: Includes a custom CSS reset (Josh Comeau's) to ensure consistent styling across browsers.
- Node.js (>=22.14.0):
- pnpm (>=10.6.1):
-
Clone the repository:
git clone [email protected]:janerikbr/kickstart.git kickstart cd kickstart
-
Install dependencies:
pnpm install
-
Kickstart your new project:
pnpm kickstart
This will prompt you for a new project name.
-
Start the development server:
pnpm dev
This will start the Vite development server. The page should automatically reload as you make changes to the code.
-
File Structure:
src/
: Contains the source code for your application.app.tsx
: The main application component, wrapping all pages.app.css
: Global CSS styles and reset.pages/
: Contains individual pages of your application.home/
: Example home page components and styles.
server/
: Server-side rendering logic.create-app.tsx
: Hono application setup.entry-server.tsx
: The entry point for server-side rendering.server.ts
: The main server file, using Hono.
public/
: Static assets (images, fonts, etc.).vite.config.ts
: Vite configuration file for client builds.vite.server.config.ts
: Vite configuration file for server builds.
-
Coding Conventions:
- Use TypeScript for all source code.
- Follow Preact best practices for component development.
- Use Vanilla Extract for type-safe CSS styling.
-
Build the client and server:
pnpm build
This will create the following directories:
dist/client/
: Contains the client-side assets (HTML, CSS, JavaScript).dist/server/
: Contains the server-side code.
-
Start the server:
pnpm start
This will start the Node.js server. Make sure you have built the project first.
This project is designed to be deployed to environments that can run Node.js applications.