Local File Storage

How Val Stores Files Locally

The /public/val Directory

Val stores all local files (images and files) in the `/public/val` directory of your project. This directory is automatically created when you first add a file through Val Studio.

File Organization

Files are organized within `/public/val` based on your project structure. When you reference files in your `.val.ts` files, you use the full path including `/public/val`:

// Example file structure:
// /public/val/hero.jpg
// /public/val/logo.png
// /public/val/video.mp4

// In your .val.ts file:
export default c.define("/content/page.val.ts", schema, {
  hero: c.image("/public/val/hero.jpg", {
    width: 1200,
    height: 800,
    alt: "Hero"
  }),
  logo: c.image("/public/val/logo.png", {
    width: 200,
    height: 100,
    alt: "Logo"
  }),
  video: c.file("/public/val/video.mp4"),
});

How s.image and s.file Work

Both `s.image()` and `s.file()` schema types expect files to be stored in `/public/val`. This ensures that:

  • Files are accessible as static assets

  • Val can track and manage file usage

  • Files are committed to your Git repository alongside your code

Note

More detailed information about file storage, optimization, and management will be added to this section.