This commit is contained in:
Benjamin Palko 2024-12-02 09:43:56 -05:00
commit f8a16a9fce
8 changed files with 95 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
node_modules
# Keep environment variables out of version control
.env

1
.tool-versions Normal file
View file

@ -0,0 +1 @@
bun 1.1.38

21
README.md Normal file
View file

@ -0,0 +1,21 @@
# Hestia
To install dependencies:
```bash
bun install
```
To run:
```bash
bun run src/index.ts
```
## Stack
- **Bun** Package manager
- **Yoga** GraphQL Server
- **Pothos**
- **Prisma** Database ORM
- **Pino** Logger

BIN
bun.lockb Executable file

Binary file not shown.

22
package.json Normal file
View file

@ -0,0 +1,22 @@
{
"name": "hestia",
"module": "src/index.ts",
"type": "module",
"scripts": {
"dev": "bun src/index.ts --watch"
},
"devDependencies": {
"@types/bun": "latest",
"@types/pino": "^7.0.5"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"dependencies": {
"@pothos/core": "^4.3.0",
"graphql": "^16.9.0",
"graphql-yoga": "^5.10.4",
"pino": "^9.5.0",
"pino-pretty": "^13.0.0"
}
}

8
src/index.ts Normal file
View file

@ -0,0 +1,8 @@
import { createYoga } from "graphql-yoga";
import { schema } from "./schema";
const yoga = createYoga({ schema });
const server = Bun.serve({ fetch: yoga.fetch });
console.log(`Server is running on: ${server.url}${yoga.graphqlEndpoint}`);

13
src/schema.ts Normal file
View file

@ -0,0 +1,13 @@
import SchemaBuilder from "@pothos/core";
const builder = new SchemaBuilder({});
builder.queryType({
fields: (t) => ({
hello: t.string({
resolve: () => "world",
}),
}),
});
export const schema = builder.toSchema();

27
tsconfig.json Normal file
View file

@ -0,0 +1,27 @@
{
"compilerOptions": {
// Enable latest features
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}