Commit Graph
147 Commits
Author SHA1 Message Date
9509b087ff docs: add contributing section (#3384)
Adds a Contributing section to the Fresh documentation covering:

- Repository structure and package layout
- Getting started (clone, `deno task ok`)
- Development workflow (docs site, vite demo, `links` for external
projects)
- Testing (commands, conventions, known local issues)

Single page at `docs/latest/contributing/index.md`.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 07:39:20 +00:00
8bf05a0127 docs: add clarification for assets/static (#3525)
This adds a short clarification how imported assets vs. static files get
handled now with Vite to the existing documentation for static files.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 19:54:04 +01:00
88bef6c2ef docs: add example for session management (#3594)
Resolves: #1216

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 19:49:01 +01:00
Douglas MouraandBartek Iwańczuk 76a9ca7d1e fix: typo in Subscribe page handler reference (#3669)
This PR removes an extra `s` on the type definition of the handler for
the page.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2026-03-25 17:59:21 +00:00
sck451 d27e20ce5e docs: fix spelling error in index.md (#3658)
Corrected the spelling of 'middelwares' to 'middlewares'.
2026-02-11 14:24:36 +01:00
madflow 9196656efb docs: fix typo in getting started documentation (#3675)
Corrected the typo 'span' to 'spawn' in the setup instructions.
2026-02-11 14:20:06 +01:00
Freddy Alvarado R a1000cbb59 docs: Update daisyUI installation instructions and file path (#3592)
The directory where the stylesheet is located is updated.
2025-11-20 09:50:35 +01:00
Marvin Hagemeister 5e94dfe9fd fix: switch to nodeModulesDir: "manual" (#3588)
The `"auto"` value causes all kinds of race conditions between various
processes trying to auto install their view of dependencies.
2025-10-30 14:50:49 +01:00
Roy Revelt 45bb094bd6 docs: fix two typos (#3577)
fixes two tiny erros in the docs
2025-10-29 17:59:23 +01:00
Brett Chalupa 662f795ae8 feat: add @/ path alias to generated projects (#3562)
Sets up `@/` as the default path alias in newly generated Fresh
projects, following the official Deno documentation guidelines. This
allows developers to use `@/` for absolute imports from the project root
instead of relative paths. This is especially convenient to remove
import that require deeply traversing up the directory tree.

The `@/` alias is now included in the imports section of deno.json for
all new projects, enabling cleaner import statements like:

```
import { Button } from "@/components/Button.tsx";
```

Fixes #3485
2025-10-21 11:24:36 +02:00
Devon Wells a2c9350cc4 docs: typos in define helpers page (#3533)
## Summary

Minor typos in define docs page I noticed while onboarding to Fresh 2.
2025-10-07 12:48:29 +02:00
Marvin Hagemeister c93e19dfbd docs: add Deno upgrade section (#3526) 2025-10-06 08:08:30 +02:00
fry69 8e9dcc087f docs: troubleshoot deploy error message (#3511)
This adds one sentence to the "My deployment won't start" section
mentioning the common `ISOLATE_INTERNAL_FAILURE` error message, so it
can get found via search.

See also discussion in Discord ->
https://discord.com/channels/684898665143206084/1422792167797166121
2025-10-02 23:47:48 +02:00
fry69 1e94e1c9c5 docs: troubleshoot VS Code extension (#3510)
This adds a short blurb how to install the VS Code extension to the
troubleshooting guide.

Possible concerns:
- maybe redundant as there are already official VS Code Deno docs
- could be shortened to just refer to the main docs or completely
removed
2025-10-01 13:20:47 +02:00
fry69 89ae0935b6 docs: troubleshoot dependency installation (#3508)
This adds:
- a short blurb about missing dependencies to the troubleshooting guide
- a hint to this guide in the getting starting page
2025-09-30 11:32:37 +02:00
Bruno Bernardino fa6f4f4bef docs: fix wrong variable name in migration guide (#3496)
You have `export const handlers = ` when it needs to be `export const
handler = `.

I'm unsure if there's any build process I need to run for this.
2025-09-26 11:03:42 +02:00
fry69 f82bd7e63d docs: add deno.json update section to migration guide (#3471)
fix #3470 

This adds a short blurb about `deno.json` focusing on imports.

Background: Without `npm:vite` and `jsr:@fresh/plugin-vite` installed it
can lead to confusing errors like this one:
```shell
$ deno task dev
vite: command not found
```

Which might lead to users install Vite globally, which is not needed
(and will not fix this problem).
2025-09-20 13:17:11 +02:00
Mau Scheff 18961995d5 docs: Revise migration guide with new help sections (#3455)
Revise migration guide with new help sections
2025-09-16 13:24:39 +02:00
Marvin Hagemeister 3867e60664 fix: improve missing build cache error message (#3441)
Hoping that this helps folks who ignore the migration guide and keep the
entry pointed to `main.ts`.
2025-09-15 19:19:10 +02:00
fry69 999b89501e docs: fix testing docs (#3419)
This fixes the testing page in the docs for real this time.

Every test is hand checked now. Thanks to a certain button, which
appeared recently.

Optionally I can also split this page up in separate pages:
- Middlewars
- AppWrappers and Layouts
- Routing and Handlers
- SSR and Islands
2025-09-15 16:53:48 +00:00
fry69 016f94e28e docs: fix minor issues in middleware docs (#3436) 2025-09-15 12:20:48 +02:00
Emil KrebsandMarvin Hagemeister b4bb004753 feat: add CSP and header middleware (#3421)
Added a CSP and header middleware to simplify the HTTP Security Response
Header creation.

Fixes:
- https://github.com/denoland/fresh/issues/1705

Example:

```ts
// main.ts

export const app = new App<State>()
    .use(csp({
        reportTo: '/api/csp-reports',
    }))
    .use(headers({
        'Cross-Origin-Resource-Policy': 'same-site',
        'Cross-Origin-Embedder-Policy': 'require-corp',
        'Cross-Origin-Opener-Policy': 'same-origin',
        'Permissions-Policy':
            'geolocation=(), camera=(), microphone=(), payment=(), usb=(), bluetooth=(), magnetometer=(), gyroscope=(), accelerometer=()',
        'Referrer-Policy': 'strict-origin-when-cross-origin',
        'X-Content-Type-Options': 'nosniff',
        'X-Frame-Options': 'DENY',
        'Strict-Transport-Security': 'max-age=63072000; includeSubDomains; preload',
    }))
```

Endpoint example:
```ts
// routes/api/csp-handler.ts

import { Context } from 'fresh';
import { State } from '../../main.ts';

export const handler = {
    async POST(ctx: Context<State>) {
        try {
            const text = await ctx.req.text();
            const body = JSON.parse(text);

            const logEntry = {
                timestamp: new Date().toISOString(),
                report: body,
                userAgent: ctx.req.headers.get('user-agent') || 'unknown',
            };
            await Deno.writeFile('csp-reports.log', new TextEncoder().encode(JSON.stringify(logEntry) + '\n'), { append: true });

            return new Response(JSON.stringify({ status: "ok" }), { status: 200 });
        } catch (error) {
            console.error("Error handling CSP report:", error);
            return new Response(JSON.stringify({ status: "error", error: String(error) }), { status: 500 });
        }
    },
};

```

Implementing these headers improved the security report at [Security
Headers](securityheaders.com) from F to A and helps to prevent security
vulnerabilities like Cross-Site Scripting and Clickjacking.

**Before**
<img width="1200" height="308" alt="image"
src="https://github.com/user-attachments/assets/01adfff4-5bb4-4cc6-bd8f-5e74b471301b"
/>
**After**
<img width="1200" height="335" alt="image"
src="https://github.com/user-attachments/assets/c5a9b07e-babf-4797-b47d-4368de70cbc3"
/>

---------

Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2025-09-15 12:20:22 +02:00
Zhi 7999d500f8 docs: fix missing files on "sharing state with islands" page (#3377)
close #3376
2025-09-12 17:16:30 +02:00
Marvin Hagemeister e06f03ac67 fix: add missing compile entry (#3410)
Fixes https://github.com/denoland/fresh/issues/3409
2025-09-12 13:08:49 +02:00
Marvin Hagemeister fc3cdc9588 docs: update cloudflare workers docs (#3405) 2025-09-12 11:04:47 +02:00
Marvin Hagemeister e30cb375d1 docs: mention entry in cloudflare worker docs (#3403)
Related https://github.com/denoland/fresh/issues/3402
2025-09-12 10:37:38 +02:00
fry69 a473cc9d9f docs: update testing with routes and islands (#3385)
closes #3383
2025-09-12 10:03:08 +02:00
fry69 a7af5c0c3d docs: add simple mountApp example (#3380)
Simple `mountApp()` example from the Discord
2025-09-10 13:41:39 +02:00
Marvin Hagemeister 79d8cfc3ed docs: make 2.x the default version (#3369) 2025-09-09 14:36:51 +02:00
Christian Svensson 24c86ea20e fix: correct anchors by using heading text only (#3167)
Addresses the issue mentioned in
https://github.com/denoland/fresh/pull/3163#discussion_r2246708003.

The issue was that the `raw` markdown was being used for e.g. `## My
title`, thus the slug became `-my-title` instead of `my-title`. Slugs
were working correctly for `codespan` in headers, e.g. ``## `someCode`
``.

I decided to hard error if unexpected heading syntax is used over
sluggifying unexpected content (can become super weird otherwise, e.g.
`## <button ...>My heading</button>`). I can revert to fallbacking to
`raw` if preferred, but perhaps with at least trimming leading `-` just
in case.
2025-08-01 12:46:12 +02:00
Christian Svensson a2de5154ec fix(docs): improve and increase consistency for code blocks (#3163)
Follow-up from #3162.

This PR does various tweaks, mostly related to code blocks.

- Adds missing titles to code blocks, and updates titles to be more
consistent
- Adds filenames to most ` ```tsx` blocks with e.g. `main.ts`, `dev.ts`
or a suitable example (e.g. `routes/greeting.tsx`) based on the code
- Adds filenames to ` ```diff` blocks if there's a relevant file, to
make the icon e.g. TS over Diff icon
  - Code blocks with Fresh code (e.g. interfaces) uses ` ```tsx fresh 🍋`
- Changes most ` ```sh` blocks with example terminal commands to ` ```sh
Terminal`
- Updates ` ```txt Project Structure` or ` ```diff Project Structure`
blocks to be more consistent
- Changes `sh` or `txt` to `txt-files` which improves highlighting and
makes icon consistent
- Renames `<project dir>` to `<project root>` to match builder `root`
option terminology
- Adds `<project root>` root folder to most/all overview folder
overviews
  - Makes the structure blocks more consistently displayed
- Tried to make some "bare" examples more complete

## Comparison

Here's a small curated set of before/after changes.

### Deployment

- `deno` highlighted in terminal commands
- `.gitignore` syntax highlighting works without using `sh` as language

<img width="1641" height="1009" alt="image"
src="https://github.com/user-attachments/assets/170cf833-1f6a-4b0d-8d2d-a081bc28a967"
/>

### File routing

Updated icon, comments same as before, but root and hierarchy have new
colors (`operator`/`function`).

<img width="1647" height="588" alt="image"
src="https://github.com/user-attachments/assets/f28db51b-4bee-45e4-be1c-e137a6d3ae3d"
/>
2025-08-01 09:07:42 +02:00
Christian Svensson c9b43ea32b feat(docs): add file/language type icons to code blocks (#3162)
I originally wanted to make it clearer the distinction between "files"
and e.g. `` ```tsx foo.tsx `` compared to `` ```sh Terminal `` or ``
```txt Project structure``. I originally started just trying to add a 📝
icon or something. But instead I ended showing file types of all
markdown languages.

I took the file type icons for the SVG's from
https://github.com/vscode-icons/vscode-icons, which has a MIT license.

I think the icons make it a even more clear what the language of the
code snippet is.

I have a follow-up PR for improving code block titles and making
examples more consistent in #3163.


## Comparisons

<details>

<summary><strong>Open &mdash; Before | After</strong></summary>


### TS + Shell icons - Hover tooltips and alt text

<img width="1504" height="639" alt="image"
src="https://github.com/user-attachments/assets/636838a3-f38c-4048-a536-52c1cdd6b6d4"
/>


### TS + Shell icons 2

<img width="1511" height="761" alt="image"
src="https://github.com/user-attachments/assets/2ad6d25c-3995-433a-ad93-162830ca55a1"
/>

### Shell + Dockerfile icons

<img width="1500" height="780" alt="image"
src="https://github.com/user-attachments/assets/88010749-d0d2-4498-9eb2-9bd971e48365"
/>

### Nested blocks + Git icon

<img width="1513" height="634" alt="image"
src="https://github.com/user-attachments/assets/400c27f8-d0b4-40bd-801d-611e1e8a8e36"
/>

</details>
2025-07-31 23:48:00 +02:00
bb23643779 feat: support tailwindcss v4 (#3054)
update /www and tailwind-plugin to support tailwind v4.

Thanks to the merge of #3034, the work of integrating and advancing
#2903 is promoted.

related #3034 
related #2903 

close #3056
close #2819

--patch-1 
based on review,

1. del compiler and make it more clean and simple,
2.  fix init tailwind part,
3. fix test tailwind part

--patch-2

1. fix the docs 
2. fix the docs of plugin and version

--patch-3
1. Addressed various maintenance tasks (chores)
2. Updated the Tailwind CSS plugin to align with this release. Generated
a fresh project using the updated init configuration and
3. deployed it via Deno Deploy EA. Deployment is functioning correctly.

--patch-4
Move postcss imports to Tailwind section in init script

--patch-5
Refactored Tailwind plugin type definitions by copying PluginOptions
properties from @tailwindcss/postcss and adding Fresh-specific exclude
option, while exporting types from package entrypoint for better
accessibility.

Test Project: https://fresh.fresh-press.deno.net/
Test Project Repository:
https://github.com/SisyphusZheng/fresh-tailwindv4
Test Plugin: https://jsr.io/@freshpress/fresh-plugin-tailwind@1.0.0

---------

Co-authored-by: 李嘉图·M·路 <146103794+Ricardo-M-Zheng@users.noreply.github.com>
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2025-07-21 16:13:34 +02:00
Weverton Marques 958b9528cc docs: fix: Change port to 3000 after setting PORT=3000 (#2828) 2025-07-18 19:14:56 +02:00
Zichao Lan 3c43d98a57 docs: update HandlerContext -> FreshContext (#3092)
'HandlerContext' is deprecated.deno-ts(6385)
2025-07-13 23:21:56 +02:00
zhizhengand李嘉图·M·路 8d3b8c53c6 docs: Update Fresh canary usage instructions in docs (#3067)
Revise documentation to clarify how to use the latest Fresh 2 canary,
specific commits, and forks via deno.json. Add instructions for creating
new projects using JSR and local sources, and update references to
current package versions. Include links to the Fresh v2 blog and
migration guide for further reading.

close #3058

---------

Co-authored-by: 李嘉图·M·路 <146103794+Ricardo-M-Zheng@users.noreply.github.com>
2025-06-30 12:27:53 +02:00
zhizheng 10400ff130 fix(www): quotes in markdown image alt causing html issues #3002 (#3003)
## Problem:
The problem was reproduced as described in #3002. Chrome DevTools shows
the following error:

props.js:137 Uncaught (in promise) InvalidCharacterError: Failed to
execute 'setAttribute' on 'Element': 'docs-content""' is not a valid
attribute name.
    at j (props.js:137:8)
    at V (index.js:528:5)
    at O (index.js:326:28)
    at I (children.js:97:16)
    at V (index.js:547:4)
    at O (index.js:326:28)
    at I (children.js:97:16)
    at V (index.js:547:4)
    at O (index.js:326:28)
    at I (children.js:97:16)

## Solution:
The issue was resolved by removing the double quotes around docs-content
in the Markdown image description. After this change, the application
resumed normal operation.

## Test:
Deno task ok and local env check

## Close:
close #3002
2025-06-04 19:32:31 +02:00
Marvin Hagemeister e595d35c44 docs: simplify introduction content (#2978)
The original text is a bit wordy. This shortens the introduction content
a bit in our docs.
2025-05-21 11:32:50 +02:00
Brian Knight b6c02b0668 docs: Fix build command in deployment documentation (#2840)
The `Self Contained Executable` instructions in the `Deployment`
documentation contains an error in the sample code.

```sh Terminal
$ deno build
$ deno compile --include static --include _fresh --include deno.json -A main.ts
```

should be:

```sh Terminal
$ deno task build
$ deno compile --include static --include _fresh --include deno.json -A main.ts
```

This PR fixes that.
2025-05-19 13:28:48 +02:00
Sviatoslav M. 1321cda916 docs: update rendering-markdown.md (#2800)
When using deno add @deno/gfm outputs the following:
```
error: @deno/gfm is missing a prefix. Did you mean `deno add jsr:@deno/gfm`?
```
Then when jsr is specified:
```
deno add jsr:@deno/gfm
Add jsr:@deno/gfm@0.10.0
```

deno --version: 2.1.4
2025-05-19 13:20:10 +02:00
Matt NieldandMarvin Hagemeister 107c25b79a chore: Update links (#2956)
This commit updates several links which are outdated and now redirect to
different URLs on the updated Deno website and documentation.

There are a few dozen instances of URLs starting with
`https:://deno.land/x` and `https:://deno.land/std`. I left these alone
since they are dependencies. Would it make sense to update these from
the versions hosted at `deno.land` to their JSR equivalents, since that
is the new and preferred location of the Deno Standard Library packages
as well as other JavaScript/TypeScript packages used by Deno projects?

For example, the latest version of the Deno Standard Library is now
hosted at `https://jsr.io/@std` instead of `https://deno.land/std`.


![image](https://github.com/user-attachments/assets/7416da3b-3867-4d8f-9a1a-79e6a11ddb46)

---------

Co-authored-by: Marvin Hagemeister <hello@marvinh.dev>
2025-05-15 19:24:27 +02:00
Asher Gomez 8ea3dbeac5 refactor(www): use useSignal() instead of useState() (#2894) 2025-05-12 23:28:46 +02:00
zhizheng 2b0f76be62 docs: improve styling for form submission example (#2899)
![before](https://github.com/user-attachments/assets/3936dcc6-d9f4-49e3-8b53-973a21eaadcd)

![after](https://github.com/user-attachments/assets/8abdb950-6473-4f0a-a27d-4a8b09229a57)

## Changes
- Added border and padding to the search input field for better
visibility
- Added light gray background and border to the search button for better
clickability

## Why
- The original styling makes it difficult to recognize the search input
field and button, as they appear as plain text elements without any
visual distinction.
2025-05-08 11:54:12 +02:00
Luca Casonato 03847e9a33 2.0.0-alpha.26 2024-12-10 16:05:22 +01:00
Ian Bull f1b6b4c401 doc: add information about deno compile (#2783) 2024-12-05 14:04:41 +01:00
Luca Casonato 6ee4551df1 2.0.0-alpha.25 2024-11-08 12:08:56 +01:00
Efe 22af15279d www: Fix block quotes not rendering links (#2712)
- Fixes a bug where block quotes were not able to properly render URLs
in docs (e.g. Info section at
https://fresh.deno.dev/docs/getting-started/create-a-route)
- Replaces existing JSX docs url with the suggested, up-to-date docs url

<img width="775" alt="image"
src="https://github.com/user-attachments/assets/e2e83456-697b-47d5-b074-66e4f287f17a">
2024-10-24 11:13:13 +02:00
Kyle Loveless e651ea514c docs: fix typo in islands/other-island.tsx (#2706)
very minor typo, but should still be fixed
2024-10-15 11:31:01 +02:00
Per Guth 4181ef3263 docs: fix formatting (#2707) 2024-10-15 11:30:29 +02:00
Marvin HagemeisterandLuca Casonato de8f1b0c59 feat: update for Deno 2 (#2655)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-09-30 18:30:30 +02:00