<html lang="en">
<head></head>
<body>

<form id="mainForm" method="post" action="https://stackblitz.com/run" target="_self">
<input type="hidden" name="project[files][.gitignore]" value=".vercel
">
<input type="hidden" name="project[files][README.md]" value="# Express Integration for RivetKit

Example project demonstrating Express web framework integration with [RivetKit](https://rivetkit.org).

[Learn More →](https://github.com/rivet-dev/rivetkit)

[Discord](https://rivet.dev/discord) — [Documentation](https://rivetkit.org) — [Issues](https://github.com/rivet-dev/rivetkit/issues)

## Getting Started

### Prerequisites

- Node.js

### Installation

```sh
git clone https://github.com/rivet-dev/rivetkit
cd rivetkit/examples/express
npm install
```

### Development

```sh
npm run dev
```

Open your browser to http://localhost:3000 to see the Express server with RivetKit integration.

## License

Apache 2.0">
<input type="hidden" name="project[files][package.json]" value="{&quot;name&quot;:&quot;example-express&quot;,&quot;version&quot;:&quot;2.0.20&quot;,&quot;private&quot;:true,&quot;type&quot;:&quot;module&quot;,&quot;scripts&quot;:{&quot;build&quot;:&quot;tsc&quot;,&quot;dev&quot;:&quot;tsx --watch src/server.ts&quot;,&quot;check-types&quot;:&quot;tsc --noEmit&quot;},&quot;devDependencies&quot;:{&quot;@types/express&quot;:&quot;^4.17.21&quot;,&quot;@types/node&quot;:&quot;^22.13.9&quot;,&quot;rivetkit&quot;:&quot;https://pkg.pr.new/rivet-dev/rivetkit/rivetkit@54999214372f9ecb3f4251a3be45c7a0eb8dfacf&quot;,&quot;tsx&quot;:&quot;^3.12.7&quot;,&quot;typescript&quot;:&quot;^5.5.2&quot;},&quot;dependencies&quot;:{&quot;@rivetkit/react&quot;:&quot;https://pkg.pr.new/rivet-dev/rivetkit/@rivetkit/react@54999214372f9ecb3f4251a3be45c7a0eb8dfacf&quot;,&quot;express&quot;:&quot;^5.1.0&quot;,&quot;react&quot;:&quot;^18.2.0&quot;,&quot;react-dom&quot;:&quot;^18.2.0&quot;},&quot;stableVersion&quot;:&quot;0.8.0&quot;}">
<input type="hidden" name="project[files][tsconfig.json]" value="{
  &quot;compilerOptions&quot;: {
    /* Visit https://aka.ms/tsconfig.json to read more about this file */

    /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
    &quot;target&quot;: &quot;esnext&quot;,
    /* Specify a set of bundled library declaration files that describe the target runtime environment. */
    &quot;lib&quot;: [&quot;esnext&quot;],
    /* Specify what JSX code is generated. */
    &quot;jsx&quot;: &quot;react-jsx&quot;,

    /* Specify what module code is generated. */
    &quot;module&quot;: &quot;esnext&quot;,
    /* Specify how TypeScript looks up a file from a given module specifier. */
    &quot;moduleResolution&quot;: &quot;bundler&quot;,
    /* Specify type package names to be included without being referenced in a source file. */
    &quot;types&quot;: [&quot;node&quot;],
    /* Enable importing .json files */
    &quot;resolveJsonModule&quot;: true,

    /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
    &quot;allowJs&quot;: true,
    /* Enable error reporting in type-checked JavaScript files. */
    &quot;checkJs&quot;: false,
    /* Ensure that each file can be safely transpiled without relying on other imports. */
    &quot;isolatedModules&quot;: true,
    /* Allow &#39;import x from y&#39; when a module doesn&#39;t have a default export. */
    &quot;allowSyntheticDefaultImports&quot;: true,
    /* Ensure that casing is correct in imports. */
    &quot;forceConsistentCasingInFileNames&quot;: true,

    /* Enable all strict type-checking options. */
    &quot;strict&quot;: true,

    /* Skip type checking all .d.ts files. */
    &quot;skipLibCheck&quot;: true,
    &quot;outDir&quot;: &quot;dist&quot;
  },
  &quot;include&quot;: [&quot;./src&quot;]
}
">
<input type="hidden" name="project[files][turbo.json]" value="{
  &quot;$schema&quot;: &quot;https://turbo.build/schema.json&quot;,
  &quot;extends&quot;: [&quot;//&quot;],
  &quot;tasks&quot;: {
    &quot;build&quot;: {
      &quot;outputs&quot;: [&quot;dist/**&quot;]
    }
  }
}
">
<input type="hidden" name="project[files][.turbo/turbo-build.log]" value="
&gt; example-express@2.0.20 build /home/runner/work/rivetkit/rivetkit/examples/express
&gt; tsc

">
<input type="hidden" name="project[files][dist/registry.js]" value="import { actor, setup } from &quot;rivetkit&quot;;
export const counter = actor({
    state: { count: 0 },
    actions: {
        increment: (c, x) =&gt; {
            c.state.count += x;
            return c.state.count;
        },
    },
});
export const registry = setup({
    use: { counter },
});
">
<input type="hidden" name="project[files][dist/server.js]" value="import express from &quot;express&quot;;
import { registry } from &quot;./registry&quot;;
// Start RivetKit
const { client } = registry.start();
// Setup router
const app = express();
// Example HTTP endpoint
app.post(&quot;/increment/:name&quot;, async (req, res) =&gt; {
    const name = req.params.name;
    const counter = client.counter.getOrCreate(name);
    const newCount = await counter.increment(1);
    res.send(`New Count: ${newCount}`);
});
app.listen(8080, () =&gt; {
    console.log(&quot;Listening at http://localhost:8080&quot;);
});
export default app;
">
<input type="hidden" name="project[files][src/registry.ts]" value="import { actor, setup } from &quot;rivetkit&quot;;

export const counter = actor({
	state: { count: 0 },
	actions: {
		increment: (c, x: number) =&gt; {
			c.state.count += x;
			return c.state.count;
		},
	},
});

export const registry = setup({
	use: { counter },
});
">
<input type="hidden" name="project[files][src/server.ts]" value="import express from &quot;express&quot;;
import { registry } from &quot;./registry&quot;;

// Start RivetKit
const { client } = registry.start();

// Setup router
const app = express();

// Example HTTP endpoint
app.post(&quot;/increment/:name&quot;, async (req, res) =&gt; {
	const name = req.params.name;

	const counter = client.counter.getOrCreate(name);
	const newCount = await counter.increment(1);

	res.send(`New Count: ${newCount}`);
});

app.listen(8080, () =&gt; {
	console.log(&quot;Listening at http://localhost:8080&quot;);
});

export default app;
">
<input type="hidden" name="project[description]" value="generated by https://pkg.pr.new">
<input type="hidden" name="project[template]" value="node">
<input type="hidden" name="project[title]" value="example-express">
</form>
<script>document.getElementById("mainForm").submit();</script>

</body></html>