commit f8a16a9fce70e7e0d2a46ee069b89b302a8b8851 Author: Benjamin Palko Date: Mon Dec 2 09:43:56 2024 -0500 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..11ddd8d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +# Keep environment variables out of version control +.env diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..51048a9 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +bun 1.1.38 diff --git a/README.md b/README.md new file mode 100644 index 0000000..ae6cb47 --- /dev/null +++ b/README.md @@ -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 diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000..f2cbd8b Binary files /dev/null and b/bun.lockb differ diff --git a/package.json b/package.json new file mode 100644 index 0000000..b18e0be --- /dev/null +++ b/package.json @@ -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" + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..8a0f745 --- /dev/null +++ b/src/index.ts @@ -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}`); diff --git a/src/schema.ts b/src/schema.ts new file mode 100644 index 0000000..8636b24 --- /dev/null +++ b/src/schema.ts @@ -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(); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..238655f --- /dev/null +++ b/tsconfig.json @@ -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 + } +}