Skip to content

Commit f7d4724

Browse files
committed
bootstrap
0 parents  commit f7d4724

15 files changed

Lines changed: 278 additions & 0 deletions

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
.env

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "es5",
4+
"quoteProps": "preserve",
5+
"plugins": []
6+
}

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"[typescript]": {
3+
"editor.defaultFormatter": "esbenp.prettier-vscode"
4+
},
5+
"json.schemaDownload.enable": true,
6+
"typescript.tsdk": "node_modules/typescript/lib"
7+
}

LICENSE

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# License (BSD-3-Clause)
2+
3+
Copyright (c) 2025 Reddit Inc.
4+
5+
Redistribution and use in source and binary forms, with or without modification,
6+
are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
2. Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
3. Neither the name of the copyright holder nor the names of its contributors
14+
may be used to endorse or promote products derived from this software without
15+
specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
18+
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20+
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
21+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Devvit Moc Tool Devvit Web
2+
3+
A starter to build mod tools using Devvit web:
4+
5+
- [Devvit](https://developers.reddit.com/): A way to build and deploy immersive games on Reddit
6+
- [Vite](https://vite.dev/): For compiling the webView
7+
- [Hono](https://hono.dev/): For backend logic
8+
- [TypeScript](https://www.typescriptlang.org/): For type safety
9+
10+
## Getting Started
11+
12+
TODO
13+
14+
## Commands
15+
16+
- `npm run dev`: Starts a development server where you can develop your application live on Reddit.
17+
- `npm run build`: Builds your client and server projects
18+
- `npm run deploy`: Uploads a new version of your app
19+
- `npm run launch`: Publishes your app for review
20+
- `npm run login`: Logs your CLI into Reddit
21+
- `npm run type-check`: Type checks, lints, and prettifies your app
22+
23+
## Cursor Integration
24+
25+
This template comes with a pre-configured cursor environment. To get started, [download cursor](https://www.cursor.com/downloads) and enable the `devvit-mcp` when prompted.

devvit.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "https://developers.reddit.com/schema/config-file.v1.json",
3+
"name": "erercever88866",
4+
"server": {
5+
"dir": "dist/server",
6+
"entry": "index.cjs"
7+
},
8+
"menu": {
9+
"items": [
10+
{
11+
"label": "Create a new post",
12+
"description": "<% name %>",
13+
"location": "subreddit",
14+
"forUserType": "moderator",
15+
"endpoint": "/internal/menu/post-create"
16+
}
17+
]
18+
},
19+
"triggers": {
20+
"onAppInstall": "/internal/triggers/on-app-install"
21+
},
22+
"scripts": {
23+
"build": "vite build",
24+
"dev": "vite build --watch"
25+
}
26+
}

eslint.config.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { defineConfig } from 'eslint/config';
2+
import globals from 'globals';
3+
import js from '@eslint/js';
4+
import tseslint from 'typescript-eslint';
5+
6+
export default defineConfig([
7+
tseslint.configs.recommended,
8+
{
9+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
10+
files: ['src/**/*.{ts,tsx,mjs,cjs,js}'],
11+
languageOptions: {
12+
ecmaVersion: 2023,
13+
globals: globals.node,
14+
parserOptions: {
15+
project: ['./tsconfig.json'],
16+
tsconfigRootDir: import.meta.dirname,
17+
},
18+
},
19+
},
20+
{
21+
files: ['**/*.{js,mjs,cjs,ts,tsx}'],
22+
rules: {
23+
'@typescript-eslint/no-floating-promises': 'error',
24+
'@typescript-eslint/no-unused-vars': ['off'],
25+
'no-unused-vars': ['off'],
26+
},
27+
ignores: [
28+
'**/node_modules/**',
29+
'**/dist/**',
30+
'**/build/**',
31+
'eslint.config.js',
32+
'**/vite.config.ts',
33+
'devvit.config.ts',
34+
],
35+
languageOptions: {
36+
parserOptions: {
37+
tsconfigRootDir: import.meta.dirname,
38+
},
39+
},
40+
plugins: { js },
41+
extends: ['js/recommended'],
42+
},
43+
]);

package.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"private": true,
3+
"name": "<% name %>",
4+
"version": "0.0.0",
5+
"license": "BSD-3-Clause",
6+
"type": "module",
7+
"scripts": {
8+
"build": "vite build",
9+
"deploy": "npm run type-check && npm run lint && npm run test && devvit upload",
10+
"dev": "devvit playtest",
11+
"launch": "npm run deploy && devvit publish",
12+
"lint": "eslint 'src/**/*.{ts,tsx}'",
13+
"login": "devvit login",
14+
"prettier": "prettier --write .",
15+
"test": "vitest run",
16+
"type-check": "tsc --build"
17+
},
18+
"engines": {
19+
"node": ">=22.12.0"
20+
},
21+
"dependencies": {
22+
"@devvit/start": "0.12.11-next-2026-01-30-17-09-49-e9c512a0d.0",
23+
"@devvit/web": "0.12.11-next-2026-01-30-17-09-49-e9c512a0d.0",
24+
"@hono/node-server": "^1.19.9",
25+
"devvit": "0.12.11-next-2026-01-30-17-09-49-e9c512a0d.0",
26+
"hono": "4.11.7"
27+
},
28+
"devDependencies": {
29+
"@eslint/js": "9.39.2",
30+
"@types/node": "^22.19.7",
31+
"eslint": "9.39.2",
32+
"globals": "17.2.0",
33+
"prettier": "3.8.1",
34+
"typescript": "5.9.3",
35+
"typescript-eslint": "8.54.0",
36+
"vite": "7.3.1"
37+
}
38+
}

src/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Hono } from 'hono';
2+
import { serve } from '@hono/node-server';
3+
import { createServer, getServerPort } from '@devvit/web/server';
4+
import { api } from './routes/api';
5+
import { forms } from './routes/forms';
6+
import { menu } from './routes/menu';
7+
import { triggers } from './routes/triggers';
8+
9+
const app = new Hono();
10+
const internal = new Hono();
11+
12+
internal.route('/menu', menu);
13+
internal.route('/form', forms);
14+
internal.route('/triggers', triggers);
15+
16+
app.route('/api', api);
17+
app.route('/internal', internal);
18+
19+
serve({
20+
fetch: app.fetch,
21+
createServer,
22+
port: getServerPort(),
23+
});

src/routes/api.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Hono } from 'hono';
2+
3+
export const api = new Hono();

0 commit comments

Comments
 (0)