Skip to main content

Understanding the project structure

info

If you’re already familiar with Bun/Node.js and modern web frameworks, feel free to skip ahead to the next section.

Before coding, let's take a moment to familiarize ourselves with HTMV's default project structure.

Image of a default project structure

Irrelevant items

These are items you usually don’t need to interact with.

  • node_modules
    Contains project dependencies installed by the package manager.
    You should not edit files here manually.
  • gitignore
    Contains the names of every file Git should not track. It's already been configured, so you shouldn't need to edit it.
  • bun.lock
    Automatically generated by Bun. No need to touch it.
  • README.md
    Automatically generated by Bun. May get removed in the future.
  • tsconfig.json
    Configures how Typescript will get compiled. It's already been configured, so you shouldn't need to edit it.
Important items

These are items you might find useful.

  • public
    Any files put here will be served at /public/. This is useful for static files such as images, javascript code, CSS styles, and others.
  • routes
    All your routes will be defined inside here.
  • views
    All your views/components will be defined inside here.
  • index.ts
    Your main entry point and the file which both configures and wakes up HTMV.
    You can run it with bun dev.
  • package.json
    Defines the project metadata, scripts, and dependencies.
    This is where you add or update packages and configure project scripts.

In short, the three folders we'll be working with will be routes, views and public.
Starting to familiarize with the structure already? If so, let's jump just straight into coding!