Giter VIP home page Giter VIP logo

jahir9991 / sveltekit-cloudflare-fullstack Goto Github PK

View Code? Open in Web Editor NEW
49.0 4.0 8.0 1.18 MB

sveltekit edge fullstack graphql with api crud + pages + worker + D1(with drizzle orm) + (supabase-postgres+ drizzle) + (neon-postgres+ drizzle) + kv crud + R2+ remote-proxy

Home Page: https://cloudflare-fullstack.pages.dev/graphql

JavaScript 1.99% TypeScript 88.11% HTML 1.67% Svelte 5.34% CSS 2.88%
cloudflare cloudflare-d1 cloudflare-kv cloudflare-pages fullstack-development sveltekit wrangler-proxy cloudflare-r2 cloudflare-workers-kv drizzle-orm

sveltekit-cloudflare-fullstack's Introduction

GraphQl :

Live Demo :: https://cloudflare-fullstack.pages.dev/graphql.

Full API documentation

Api doc:: https://cloudflare-fullstack.pages.dev/doc/.

postgres(supabase) + drizzle-orm

get data from postgres::https://cloudflare-fullstack.pages.dev/api/supabase.

cloudflare D1 + drizzle-orm

get data from D1 ::https://cloudflare-fullstack.pages.dev/api/d1/users.

cloudflare KV

get data from KV ::https://cloudflare-fullstack.pages.dev/api/kv.

graphql

//hooks.server.ts
if (event.url.pathname.startsWith('/graphql')) {
	await injectD1(event);
	return GraphQLServer(event);
}

//need to add Compatibility flags in cf dashboard

//src/graphQL.server.ts
export const GraphQLServer = (context) => {
	return createYoga({
		schema: makeExecutableSchema({
			resolvers: [userResolver, postResolver],
			typeDefs: [globalTypeDefination, userTypeDefinitions, postTypeDefination]
		}),
		context,
		graphqlEndpoint: '/graphql',
		landingPage: true,
		multipart: true,
		cors: true,
		logging: 'error'
	}).handle(context.request, context.response);
};

prerequesite

# need to add this proxy package for proxy cloudflare remote assets 
"cfw-bindings-wrangler-bridge" 



#need to add Compatibility flags in cf dashboard
Compatibility flags: nodejs_compat

wrangler.toml

#example.wrangler.toml

name = "cloudflare-fullstack"
compatibility_date = "2023-08-14"
compatibility_flags = ["nodejs_compat"]




# for local dev....
vars = { ENVIRONMENT = "dev" ,BASE_URL = "dev.example.com"}
d1_databases =[{ binding = "DB" ,database_name = "cloudflare_fullstack_db" , database_id = "{id from cloudflare}"  , migrations_dir = "migrationsD1" }]
kv_namespaces =[{ binding = "KV" , id = "{id from cloudflare}"  , preview_id = "{id from cloudflare}" }]


[env.staging]
vars = { ENVIRONMENT = "staging" ,BASE_URL = "staging.example.com"}
d1_databases =[{ binding = "DB" ,database_name = "cloudflare_fullstack_db" , database_id = "{id from cloudflare}"  , migrations_dir = "migrationsD1" }]
kv_namespaces =[{ binding = "KV" , id = "{id from cloudflare}"  , preview_id = "{id from cloudflare}" }]


[env.production]
vars = { ENVIRONMENT = "production" ,BASE_URL = "example.com"}
d1_databases =[{ binding = "DB" ,database_name = "cloudflare_fullstack_db" , database_id = "{id from cloudflare}" , migrations_dir = "migrationsD1" }]
kv_namespaces =[{ binding = "KV" , id = "{id from cloudflare}"  , preview_id = "{id from cloudflare}" }]



Developing

install dependencies with npm install (or pnpm install or yarn),

Start a proxy server if you want to access your remote Cloudflare resources:

npm run proxy
# "proxy": "wrangler dev node_modules/cfw-bindings-wrangler-bridge/worker/index.js --remote --env staging --ip 127.0.0.1 --port 8787",


# or start the sveltekit server and open the app in a new browser tab
npm run start -- --open

Building

To create a production version of your app:

npm run build

You can preview the production build with npm run preview.

๐Ÿ’ช Contributions

We welcome contributions ! If you have an idea for a new feature or have found a bug, please open an issue in the repository. If you'd like to submit a fix or new feature, please create a pull request with a detailed description of your changes.

sveltekit-cloudflare-fullstack's People

Contributors

chientrm avatar jahir9991 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sveltekit-cloudflare-fullstack's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.