├── .github └── workflows │ ├── fastapi_crud.yml │ ├── flask_crud.yml │ ├── nestjs_crud.yml │ ├── phoenix_github_oauth.yml │ └── strawberry_gql.yml ├── .gitignore ├── README.md ├── agent-memory-triggers ├── .gitignore ├── .python-version ├── LICENSE ├── README.md ├── dbschema │ ├── default.gel │ ├── migrations │ │ └── 00001-m1wyx65.edgeql │ └── scoping.gel ├── gel.toml ├── pyproject.toml ├── src │ └── agent_memory_triggers │ │ ├── __init__.py │ │ ├── agents │ │ ├── __init__.py │ │ ├── extractor.py │ │ ├── summarizer.py │ │ └── talker.py │ │ ├── common │ │ └── types.py │ │ ├── db.py │ │ ├── gui.py │ │ ├── main.py │ │ ├── queries │ │ ├── delete.edgeql │ │ └── insert.edgeql │ │ └── routers │ │ ├── __init__.py │ │ ├── agent_api.py │ │ └── chat_api.py └── uv.lock ├── cloudflare-workers ├── .gitignore ├── .prettierrc ├── README.md ├── dbschema │ ├── default.esdl │ └── migrations │ │ └── 00001.edgeql ├── edgedb.toml ├── package.json ├── src │ └── index.ts ├── tsconfig.json ├── worker-configuration.d.ts └── wrangler.toml ├── deno-fresh ├── .gitignore ├── .vscode │ └── settings.json ├── README.md ├── dbschema │ ├── default.esdl │ └── migrations │ │ ├── 00001.edgeql │ │ └── 00002.edgeql ├── deno.json ├── dev.ts ├── edgedb.toml ├── fresh.gen.ts ├── import_map.json ├── islands │ └── Counter.tsx ├── main.ts ├── routes │ └── index.tsx ├── static │ ├── favicon.ico │ └── logo.svg └── test.ts ├── docs-chatbot ├── .eslintrc.json ├── .gitignore ├── README.md ├── app │ ├── api │ │ └── generate-answer │ │ │ └── route.ts │ ├── constants.ts │ ├── favicon.ico │ ├── globals.css │ ├── layout.tsx │ └── page.tsx ├── dbschema │ ├── default.esdl │ └── migrations │ │ └── 00001.edgeql ├── docs │ └── edgeql │ │ ├── design-goals.md │ │ ├── overview.md │ │ └── try-edgeql.md ├── edgedb.toml ├── generate-embeddings.ts ├── next.config.js ├── package-lock.json ├── package.json ├── postcss.config.js ├── public │ ├── next.svg │ └── vercel.svg ├── tailwind.config.js ├── tsconfig.json ├── types │ └── sse.d.ts └── utils.ts ├── drizzle-book-notes-app ├── .gitignore ├── README.md ├── app │ ├── api │ │ ├── books │ │ │ ├── [id] │ │ │ │ ├── notes │ │ │ │ │ └── route.ts │ │ │ │ └── route.ts │ │ │ └── route.ts │ │ └── notes │ │ │ └── [id] │ │ │ └── route.ts │ ├── books │ │ ├── [id] │ │ │ ├── edit │ │ │ │ └── page.tsx │ │ │ └── page.tsx │ │ └── add │ │ │ └── page.tsx │ ├── favicon.ico │ ├── globals.css │ ├── layout.tsx │ └── page.tsx ├── dbschema │ ├── default.gel │ ├── migrations │ │ └── 00001-m1ua7xc.edgeql │ └── scoping.gel ├── drizzle.config.ts ├── drizzle │ ├── relations.ts │ └── schema.ts ├── eslint.config.mjs ├── gel.toml ├── next.config.ts ├── package-lock.json ├── package.json ├── postcss.config.mjs ├── public │ ├── file.svg │ ├── globe.svg │ ├── next.svg │ ├── vercel.svg │ └── window.svg ├── src │ ├── components │ │ └── BookForm.tsx │ └── db │ │ └── index.ts └── tsconfig.json ├── express-auth ├── .gitignore ├── README.md ├── auth.ts ├── builtin.ts ├── custom.ts ├── db.ts ├── dbschema │ ├── default.esdl │ └── migrations │ │ ├── 00001.edgeql │ │ └── 00002.edgeql ├── edgedb.toml ├── package-lock.json ├── package.json ├── styles.ts ├── todos.ts └── tsconfig.json ├── fastapi-crud-auth ├── .flake8 ├── .gitignore ├── Makefile ├── README.md ├── app │ ├── __init__.py │ ├── auth.py │ ├── events.py │ ├── main.py │ ├── queries │ │ ├── create_event.edgeql │ │ ├── create_user.edgeql │ │ ├── delete_event.edgeql │ │ ├── delete_user.edgeql │ │ ├── get_event_by_name.edgeql │ │ ├── get_events.edgeql │ │ ├── get_user_by_name.edgeql │ │ ├── get_users.edgeql │ │ ├── update_event.edgeql │ │ └── update_user.edgeql │ └── users.py ├── dbschema │ ├── default.esdl │ └── migrations │ │ ├── 00001.edgeql │ │ ├── 00002.edgeql │ │ ├── 00003.edgeql │ │ ├── 00004.edgeql │ │ ├── 00005.edgeql │ │ ├── 00006.edgeql │ │ ├── 00007.edgeql │ │ ├── 00008.edgeql │ │ ├── 00009-m1co2rs.edgeql │ │ └── 00010-m1gme45.edgeql ├── edgedb.toml ├── pyproject.toml ├── scripts │ └── health_check └── tests │ ├── __init__.py │ ├── conftest.py │ ├── fixture.edgeql │ ├── test_events.py │ └── test_users.py ├── fastapi-crud ├── .flake8 ├── .gitignore ├── Makefile ├── README.md ├── app │ ├── __init__.py │ ├── events.py │ ├── main.py │ ├── queries │ │ ├── create_event.edgeql │ │ ├── create_user.edgeql │ │ ├── delete_event.edgeql │ │ ├── delete_user.edgeql │ │ ├── get_event_by_name.edgeql │ │ ├── get_events.edgeql │ │ ├── get_user_by_name.edgeql │ │ ├── get_users.edgeql │ │ ├── update_event.edgeql │ │ └── update_user.edgeql │ └── users.py ├── dbschema │ ├── default.esdl │ └── migrations │ │ ├── 00001.edgeql │ │ ├── 00002.edgeql │ │ ├── 00003.edgeql │ │ ├── 00004.edgeql │ │ ├── 00005.edgeql │ │ ├── 00006.edgeql │ │ ├── 00007.edgeql │ │ └── 00008.edgeql ├── edgedb.toml ├── pyproject.toml ├── scripts │ └── health_check └── tests │ ├── __init__.py │ ├── conftest.py │ ├── fixture.edgeql │ ├── test_events.py │ └── test_users.py ├── fastapi-gelai ├── .gitignore ├── .python-version ├── README.md ├── app │ ├── __init__.py │ ├── main.py │ ├── queries │ │ ├── add_message.edgeql │ │ ├── add_message_async_edgeql.py │ │ ├── create_chat.edgeql │ │ ├── create_chat_async_edgeql.py │ │ ├── create_user.edgeql │ │ ├── create_user_async_edgeql.py │ │ ├── get_chat_by_id.edgeql │ │ ├── get_chat_by_id_async_edgeql.py │ │ ├── get_chats.edgeql │ │ ├── get_chats_async_edgeql.py │ │ ├── get_messages.edgeql │ │ ├── get_messages_async_edgeql.py │ │ ├── get_user_by_name.edgeql │ │ ├── get_user_by_name_async_edgeql.py │ │ ├── get_users.edgeql │ │ ├── get_users_async_edgeql.py │ │ ├── search_chats.edgeql │ │ └── search_chats_async_edgeql.py │ ├── sample_data │ │ ├── inserts.edgeql │ │ └── inserts_async_edgeql.py │ └── web.py ├── dbschema │ └── default.esdl ├── edgedb.toml ├── pyproject.toml └── uv.lock ├── flask-crud ├── .editorconfig ├── .flake8 ├── .gitignore ├── .pre-commit-config.yaml ├── Makefile ├── README.md ├── app │ ├── actors.py │ ├── main.py │ └── movies.py ├── dbschema │ ├── default.esdl │ └── migrations │ │ └── 00001.edgeql ├── edgedb.toml ├── pyproject.toml ├── requirements-dev.in ├── requirements-dev.txt ├── requirements.in ├── requirements.txt └── scripts │ └── health_check ├── flask-proxy ├── .editorconfig ├── .flake8 ├── .gitignore ├── .pre-commit-config.yaml ├── Makefile ├── README.md ├── app │ ├── main.py │ └── static │ │ └── index.html ├── dbschema │ ├── default.esdl │ └── migrations │ │ └── 00001.edgeql ├── edgedb.toml ├── populate.py ├── pyproject.toml ├── requirements-dev.in ├── requirements-dev.txt ├── requirements.in └── requirements.txt ├── flutter ├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── flutter_example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── dbschema │ ├── default.esdl │ └── migrations │ │ ├── 00001.edgeql │ │ └── 00002.edgeql ├── edgedb.toml ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ ├── getNRandomMovies.edgeql │ └── main.dart ├── linux │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ ├── main.cc │ ├── my_application.cc │ └── my_application.h ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ └── MainMenu.xib │ │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements ├── pubspec.lock ├── pubspec.yaml ├── test │ └── widget_test.dart ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── index.html │ └── manifest.json └── windows │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake │ └── runner │ ├── CMakeLists.txt │ ├── Runner.rc │ ├── flutter_window.cpp │ ├── flutter_window.h │ ├── main.cpp │ ├── resource.h │ ├── resources │ └── app_icon.ico │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h ├── go-workout ├── 01-workouts │ ├── dbschema │ │ ├── default.esdl │ │ └── migrations │ │ │ └── 00001.edgeql │ ├── edgedb.toml │ ├── frontend │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── public │ │ │ ├── favicon.png │ │ │ ├── global.css │ │ │ └── index.html │ │ ├── rollup.config.js │ │ ├── scripts │ │ │ └── setupTypeScript.js │ │ └── src │ │ │ ├── App.svelte │ │ │ ├── main.js │ │ │ ├── pages │ │ │ ├── Index.svelte │ │ │ └── Workout.svelte │ │ │ └── routes.js │ ├── go.mod │ ├── go.sum │ ├── internal │ │ ├── db │ │ │ └── db.go │ │ └── workout │ │ │ └── workout.go │ ├── main.go │ └── tutorial.md ├── 02-exercise │ ├── dbschema │ │ ├── default.esdl │ │ └── migrations │ │ │ ├── 00001.edgeql │ │ │ └── 00002.edgeql │ ├── edgedb.toml │ ├── frontend │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── public │ │ │ ├── favicon.png │ │ │ ├── global.css │ │ │ └── index.html │ │ ├── rollup.config.js │ │ ├── scripts │ │ │ └── setupTypeScript.js │ │ └── src │ │ │ ├── App.svelte │ │ │ ├── main.js │ │ │ ├── pages │ │ │ ├── Exercise.svelte │ │ │ ├── Index.svelte │ │ │ └── Workout.svelte │ │ │ └── routes.js │ ├── go.mod │ ├── go.sum │ ├── internal │ │ ├── db │ │ │ └── db.go │ │ ├── exercise │ │ │ └── exercise.go │ │ └── workout │ │ │ └── workout.go │ ├── main.go │ └── tutorial.md ├── 03-sets │ ├── dbschema │ │ ├── default.esdl │ │ └── migrations │ │ │ ├── 00001.edgeql │ │ │ ├── 00002.edgeql │ │ │ └── 00003.edgeql │ ├── edgedb.toml │ ├── frontend │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── public │ │ │ ├── favicon.png │ │ │ ├── global.css │ │ │ └── index.html │ │ ├── rollup.config.js │ │ ├── scripts │ │ │ └── setupTypeScript.js │ │ └── src │ │ │ ├── App.svelte │ │ │ ├── main.js │ │ │ ├── pages │ │ │ ├── Exercise.svelte │ │ │ ├── Index.svelte │ │ │ └── Workout.svelte │ │ │ └── routes.js │ ├── go.mod │ ├── go.sum │ ├── internal │ │ ├── db │ │ │ └── db.go │ │ ├── exercise │ │ │ └── exercise.go │ │ ├── set │ │ │ └── set.go │ │ └── workout │ │ │ └── workout.go │ ├── main.go │ └── tutorial.md └── README.md ├── langchain-codegen ├── .gitignore ├── README.md ├── dbschema │ ├── default.gel │ ├── migrations │ │ └── 00001-m16oddm.edgeql │ └── scoping.gel ├── gel.toml ├── md_docs │ └── intro │ │ ├── branches.md │ │ ├── cli.md │ │ ├── clients.md │ │ ├── edgeql.md │ │ ├── guides │ │ ├── ai │ │ │ ├── edgeql.md │ │ │ ├── index.md │ │ │ └── python.md │ │ ├── drizzle │ │ │ ├── index.md │ │ │ └── nextjs.md │ │ └── index.md │ │ ├── index.md │ │ ├── instances.md │ │ ├── migrations.md │ │ ├── projects.md │ │ ├── quickstart │ │ ├── ai │ │ │ ├── fastapi.md │ │ │ └── index.md │ │ ├── connecting │ │ │ ├── fastapi.md │ │ │ ├── index.md │ │ │ └── nextjs.md │ │ ├── index.md │ │ ├── inheritance │ │ │ ├── fastapi.md │ │ │ ├── index.md │ │ │ └── nextjs.md │ │ ├── modeling │ │ │ ├── fastapi.md │ │ │ ├── index.md │ │ │ └── nextjs.md │ │ ├── overview │ │ │ ├── fastapi.md │ │ │ ├── index.md │ │ │ └── nextjs.md │ │ ├── setup │ │ │ ├── fastapi.md │ │ │ ├── index.md │ │ │ └── nextjs.md │ │ └── working │ │ │ ├── fastapi.md │ │ │ ├── index.md │ │ │ └── nextjs.md │ │ ├── schema.md │ │ └── tutorials │ │ ├── ai_fastapi_searchbot.md │ │ ├── gel_drizzle_booknotes.md │ │ └── index.md ├── pyproject.toml ├── src │ └── langchain_codegen │ │ ├── __init__.py │ │ ├── agent.py │ │ └── rag.py └── uv.lock ├── llamaindex-gel-helper ├── README.md ├── dbschema │ ├── default.gel │ └── scoping.gel ├── example_inserts.edgeql ├── gel.toml ├── md_docs │ └── intro │ │ ├── branches.md │ │ ├── cli.md │ │ ├── clients.md │ │ ├── edgeql.md │ │ ├── guides │ │ ├── ai │ │ │ ├── edgeql.md │ │ │ ├── index.md │ │ │ └── python.md │ │ ├── drizzle │ │ │ ├── index.md │ │ │ └── nextjs.md │ │ └── index.md │ │ ├── index.md │ │ ├── instances.md │ │ ├── migrations.md │ │ ├── projects.md │ │ ├── quickstart │ │ ├── ai │ │ │ ├── fastapi.md │ │ │ └── index.md │ │ ├── connecting │ │ │ ├── fastapi.md │ │ │ ├── index.md │ │ │ └── nextjs.md │ │ ├── index.md │ │ ├── inheritance │ │ │ ├── fastapi.md │ │ │ ├── index.md │ │ │ └── nextjs.md │ │ ├── modeling │ │ │ ├── fastapi.md │ │ │ ├── index.md │ │ │ └── nextjs.md │ │ ├── overview │ │ │ ├── fastapi.md │ │ │ ├── index.md │ │ │ └── nextjs.md │ │ ├── setup │ │ │ ├── fastapi.md │ │ │ ├── index.md │ │ │ └── nextjs.md │ │ └── working │ │ │ ├── fastapi.md │ │ │ ├── index.md │ │ │ └── nextjs.md │ │ ├── schema.md │ │ └── tutorials │ │ ├── ai_fastapi_searchbot.md │ │ ├── gel_drizzle_booknotes.md │ │ └── index.md ├── pyproject.toml ├── src │ └── llamaindex_gel_helper │ │ ├── __init__.py │ │ ├── agent.py │ │ └── rag.py └── uv.lock ├── nestjs-crud ├── .editorconfig ├── .eslintrc.js ├── .gitignore ├── .prettierrc ├── README.md ├── dbschema │ ├── default.esdl │ └── migrations │ │ ├── 00001.edgeql │ │ ├── 00002.edgeql │ │ ├── 00003.edgeql │ │ ├── 00004.edgeql │ │ └── 00005.edgeql ├── edgedb.toml ├── nest-cli.json ├── package-lock.json ├── package.json ├── scripts │ └── health_check ├── src │ ├── actor │ │ ├── actor.controller.spec.ts │ │ ├── actor.controller.ts │ │ ├── actor.dto.ts │ │ └── actor.service.ts │ ├── app.module.ts │ └── main.ts ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json ├── tsconfig.build.json └── tsconfig.json ├── nextjs-access-policies-clerk ├── .env.local ├── .env.local.sample ├── .gitignore ├── .prettierrc.json ├── README.md ├── client.js ├── components │ ├── Header.js │ └── Layout.js ├── dbschema │ ├── default.esdl │ └── migrations │ │ └── 00001.edgeql ├── edgedb.toml ├── index.mjs ├── package-lock.json ├── package.json ├── pages │ ├── _app.js │ ├── index.js │ ├── sign-in │ │ └── [[...index]].js │ ├── sign-up │ │ └── [[...index]].js │ └── user │ │ └── [[...index]].js ├── public │ ├── clerk.svg │ ├── favicon.ico │ ├── icons │ │ ├── arrow-right.svg │ │ ├── download.svg │ │ ├── external-link.svg │ │ ├── layout.svg │ │ ├── server.svg │ │ ├── settings.svg │ │ ├── shield-check.svg │ │ ├── sparkles.svg │ │ └── user-plus.svg │ ├── logo.svg │ ├── nextjs.svg │ └── vercel.svg ├── styles │ ├── Header.module.css │ ├── Home.module.css │ └── globals.css └── yarn.lock ├── nextjs-auth ├── .gitignore ├── README.md ├── dbschema │ ├── default.esdl │ └── migrations │ │ └── 00001.edgeql ├── edgedb.toml ├── next.config.js ├── package-lock.json ├── package.json ├── postcss.config.js ├── public │ ├── next.svg │ └── vercel.svg ├── src │ ├── actions.ts │ ├── app │ │ ├── _components │ │ │ ├── auth.tsx │ │ │ └── todos.tsx │ │ ├── auth │ │ │ └── [...auth] │ │ │ │ └── route.ts │ │ ├── favicon.ico │ │ ├── forgot-password │ │ │ └── page.tsx │ │ ├── globals.css │ │ ├── icons.tsx │ │ ├── layout.tsx │ │ ├── page.tsx │ │ ├── reset-password │ │ │ └── page.tsx │ │ ├── signin │ │ │ └── page.tsx │ │ ├── signup │ │ │ └── page.tsx │ │ └── todos.tsx │ └── edgedb.ts ├── tailwind.config.ts └── tsconfig.json ├── nextjs-blog-app-router ├── .eslintrc.json ├── .gitignore ├── README.md ├── app │ ├── favicon.ico │ ├── globals.css │ ├── layout.tsx │ ├── page.tsx │ └── post │ │ └── [id] │ │ └── page.tsx ├── dbschema │ ├── default.esdl │ └── migrations │ │ └── 00001.edgeql ├── edgedb.toml ├── next.config.mjs ├── package.json ├── pnpm-lock.yaml ├── postcss.config.js ├── public │ ├── next.svg │ └── vercel.svg ├── tailwind.config.ts └── tsconfig.json ├── nextjs-blog ├── .eslintrc.json ├── .gitignore ├── README.md ├── dbschema │ ├── default.esdl │ └── migrations │ │ └── 00001.edgeql ├── edgedb.toml ├── next-env.d.ts ├── next.config.js ├── package.json ├── pages │ ├── _app.tsx │ ├── api │ │ └── post.ts │ ├── index.tsx │ └── post │ │ └── [id].tsx ├── public │ ├── favicon.ico │ └── vercel.svg ├── seed.ts ├── styles │ ├── Home.module.css │ └── globals.css ├── tsconfig.json └── yarn.lock ├── nextjs-todo ├── .eslintrc.js ├── .gitignore ├── README.md ├── client.ts ├── components │ └── ListItem.tsx ├── dbschema │ ├── default.esdl │ └── migrations │ │ ├── 00001.edgeql │ │ └── cd ├── edgedb.toml ├── next-env.d.ts ├── next.config.js ├── package-lock.json ├── package.json ├── pages │ ├── [filter].tsx │ ├── _app.tsx │ └── api │ │ └── todo │ │ ├── [id].ts │ │ ├── clearCompleted.ts │ │ └── index.ts ├── public │ ├── favicon.ico │ ├── powered-by-vercel.svg │ └── vercel.svg ├── tsconfig.json └── yarn.lock ├── phoenix-github-oauth ├── .formatter.exs ├── .gitignore ├── LICENSE.md ├── README.md ├── config │ ├── config.exs │ ├── dev.exs │ ├── prod.exs │ ├── runtime.exs │ └── test.exs ├── dbschema │ ├── default.esdl │ └── migrations │ │ └── 00001.edgeql ├── edgedb.toml ├── lib │ ├── github_oauth.ex │ ├── github_oauth │ │ ├── accounts.ex │ │ ├── accounts │ │ │ ├── identity.ex │ │ │ └── user.ex │ │ ├── application.ex │ │ ├── edgedb.ex │ │ └── github.ex │ ├── github_oauth_web.ex │ └── github_oauth_web │ │ ├── controllers │ │ ├── oauth_callback_controller.ex │ │ └── user_controller.ex │ │ ├── endpoint.ex │ │ ├── router.ex │ │ ├── telemetry.ex │ │ └── views │ │ ├── error_helpers.ex │ │ └── error_view.ex ├── mix.exs ├── mix.lock ├── priv │ └── edgeql │ │ └── accounts │ │ ├── get_identity_for_user.edgeql │ │ ├── get_user_by_id.edgeql │ │ ├── get_user_by_provider.edgeql │ │ ├── register_github_user.edgeql │ │ └── update_identity_token.edgeql └── test │ ├── github_oauth_web │ ├── controllers │ │ └── user_controller_test.exs │ └── views │ │ └── error_view_test.exs │ ├── support │ ├── conn_case.ex │ ├── data_case.ex │ └── fixtures │ │ └── accounts_fixtures.ex │ └── test_helper.exs ├── remix-auth ├── .eslintrc.cjs ├── .gitignore ├── README.md ├── app │ ├── components │ │ ├── auth │ │ │ ├── ForgotPasswordForm.tsx │ │ │ ├── ResendVerificationEmail.tsx │ │ │ ├── ResetPasswordForm.tsx │ │ │ ├── SigninForm.tsx │ │ │ ├── SignupForm.tsx │ │ │ └── SubmitButton.tsx │ │ └── todos │ │ │ ├── TodoCard.tsx │ │ │ ├── TodoList.tsx │ │ │ └── index.tsx │ ├── entry.client.tsx │ ├── entry.server.tsx │ ├── icons.tsx │ ├── root.tsx │ ├── routes │ │ ├── _index.tsx │ │ ├── auth.$.ts │ │ ├── forgot-password.tsx │ │ ├── reset-password.tsx │ │ ├── signin.tsx │ │ ├── signout.tsx │ │ └── signup.tsx │ ├── services │ │ ├── auth.server.ts │ │ └── auth.ts │ ├── tailwind.css │ └── utils.ts ├── dbschema │ ├── default.esdl │ └── migrations │ │ └── 00001.edgeql ├── edgedb.toml ├── package-lock.json ├── package.json ├── public │ └── favicon.ico ├── remix.config.js ├── remix.env.d.ts ├── tailwind.config.ts └── tsconfig.json ├── remix ├── .dockerignore ├── .env.example ├── .eslintrc.js ├── .gitignore ├── .prettierrc ├── Dockerfile ├── README.md ├── app │ ├── components │ │ └── joke.tsx │ ├── entry.client.tsx │ ├── entry.server.tsx │ ├── root.tsx │ ├── routes │ │ ├── index.tsx │ │ ├── jokes.tsx │ │ ├── jokes │ │ │ ├── $jokeId.tsx │ │ │ ├── index.tsx │ │ │ └── new.tsx │ │ ├── jokes[.]rss.tsx │ │ ├── login.tsx │ │ └── logout.tsx │ ├── styles │ │ ├── global-large.css │ │ ├── global-medium.css │ │ ├── global.css │ │ ├── index.css │ │ ├── jokes.css │ │ └── login.css │ └── utils │ │ ├── db.server.ts │ │ └── session.server.ts ├── dbschema │ ├── default.esdl │ ├── migrations │ │ └── 00001.edgeql │ └── seed.ts ├── edgedb.toml ├── fly.toml ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ ├── fonts │ │ └── baloo │ │ │ ├── SIL Open Font License.txt │ │ │ └── baloo.woff │ └── social.png ├── remix.config.js ├── remix.env.d.ts ├── sandbox.config.json ├── start_with_migrations.sh └── tsconfig.json ├── strawberry-gql ├── .editorconfig ├── .flake8 ├── .gitignore ├── .pre-commit-config.yaml ├── Makefile ├── README.md ├── app │ ├── __init__.py │ ├── main.py │ └── schema.py ├── dbschema │ ├── default.esdl │ └── migrations │ │ └── 00001.edgeql ├── edgedb.toml ├── gql │ └── queries.graphql ├── pyproject.toml ├── requirements-dev.in ├── requirements-dev.txt ├── requirements.in ├── requirements.txt └── scripts │ └── health_check ├── sveltekit-auth ├── .gitignore ├── .npmrc ├── .yarnrc.yml ├── README.md ├── dbschema │ ├── default.esdl │ └── migrations │ │ └── 00001.edgeql ├── edgedb.toml ├── package.json ├── postcss.config.js ├── src │ ├── app.css │ ├── app.d.ts │ ├── app.html │ ├── error.html │ ├── hooks.server.ts │ ├── lib │ │ ├── auth.ts │ │ ├── components │ │ │ ├── auth │ │ │ │ ├── ForgotPasswordForm.svelte │ │ │ │ ├── ResendVerificationEmail.svelte │ │ │ │ ├── ResetPasswordForm.svelte │ │ │ │ ├── SignInForm.svelte │ │ │ │ ├── SignUpForm.svelte │ │ │ │ └── SubmitButton.svelte │ │ │ └── todos │ │ │ │ ├── TodoCard.svelte │ │ │ │ ├── TodoList.svelte │ │ │ │ └── types.ts │ │ ├── server │ │ │ ├── auth.ts │ │ │ ├── database.ts │ │ │ └── utils.ts │ │ └── utils.ts │ └── routes │ │ ├── +layout.svelte │ │ ├── +page.server.ts │ │ ├── +page.svelte │ │ ├── forgot-password │ │ ├── +page.server.ts │ │ └── +page.svelte │ │ ├── reset-password │ │ ├── +page.server.ts │ │ └── +page.svelte │ │ ├── signin │ │ ├── +page.server.ts │ │ └── +page.svelte │ │ ├── signout │ │ └── +page.server.ts │ │ ├── signup │ │ ├── +page.server.ts │ │ └── +page.svelte │ │ └── styles.css ├── static │ ├── favicon.png │ └── robots.txt ├── svelte.config.js ├── tailwind.config.js ├── tsconfig.json ├── vite.config.ts └── yarn.lock └── sveltekit ├── .eslintignore ├── .eslintrc.cjs ├── .gitignore ├── .npmrc ├── .nvmrc ├── .prettierignore ├── .prettierrc ├── README.md ├── dbschema ├── default.esdl └── migrations │ └── 00001.edgeql ├── edgedb.toml ├── package-lock.json ├── package.json ├── playwright.config.ts ├── src ├── app.css ├── app.d.ts ├── app.html ├── hooks.ts ├── lib │ ├── Counter.svelte │ ├── edgedb.ts │ ├── form.ts │ └── header │ │ ├── Header.svelte │ │ └── svelte-logo.svg └── routes │ ├── +layout.svelte │ ├── +page.svelte │ ├── +page.ts │ ├── about │ ├── +page.svelte │ └── +page.ts │ └── todos │ ├── +page.server.ts │ └── +page.svelte ├── static ├── favicon.png ├── robots.txt ├── svelte-welcome.png └── svelte-welcome.webp ├── svelte.config.js ├── tests └── test.ts ├── tsconfig.json └── vite.config.js /agent-memory-triggers/.python-version: -------------------------------------------------------------------------------- 1 | 3.13 2 | -------------------------------------------------------------------------------- /agent-memory-triggers/README.md: -------------------------------------------------------------------------------- 1 | # agent-mem 2 | Agent memory demo with Gel 3 | -------------------------------------------------------------------------------- /agent-memory-triggers/dbschema/scoping.gel: -------------------------------------------------------------------------------- 1 | # Use a simpler algorithm for resolving the scope of object names. 2 | # This behavior will become the default in Gel 7.0. 3 | # See: https://docs.edgedb.com/database/edgeql/path_resolution#new-path-scoping 4 | using future simple_scoping; 5 | -------------------------------------------------------------------------------- /agent-memory-triggers/gel.toml: -------------------------------------------------------------------------------- 1 | watch = [] 2 | 3 | [instance] 4 | server-version = "6.7" 5 | -------------------------------------------------------------------------------- /agent-memory-triggers/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "agent-memory-triggers" 3 | version = "0.1.0" 4 | description = "Add your description here" 5 | readme = "README.md" 6 | authors = [ 7 | { name = "anbuzin", email = "contactbuzin@gmail.com" } 8 | ] 9 | requires-python = ">=3.13" 10 | dependencies = [ 11 | "fastapi[standard]>=0.115.12", 12 | "gel>=3.0.1", 13 | "httpx>=0.28.1", 14 | "pydantic-ai>=0.1.8", 15 | "python-dotenv>=1.1.0", 16 | "streamlit>=1.44.1", 17 | ] 18 | 19 | [project.scripts] 20 | agent-memory-triggers = "agent_memory_triggers:main" 21 | 22 | [build-system] 23 | requires = ["hatchling"] 24 | build-backend = "hatchling.build" 25 | -------------------------------------------------------------------------------- /agent-memory-triggers/src/agent_memory_triggers/__init__.py: -------------------------------------------------------------------------------- 1 | def main() -> None: 2 | print("Hello from agent-mem!") 3 | -------------------------------------------------------------------------------- /agent-memory-triggers/src/agent_memory_triggers/agents/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/agent-memory-triggers/src/agent_memory_triggers/agents/__init__.py -------------------------------------------------------------------------------- /agent-memory-triggers/src/agent_memory_triggers/agents/summarizer.py: -------------------------------------------------------------------------------- 1 | from pydantic_ai import Agent 2 | 3 | 4 | agent = Agent("openai:gpt-4o-mini") 5 | 6 | 7 | @agent.system_prompt 8 | def get_system_prompt(): 9 | return "You are a summarizer that can summarize interactions between a user and an AI assistant." 10 | 11 | 12 | def get_summarizer_agent(): 13 | return agent 14 | -------------------------------------------------------------------------------- /agent-memory-triggers/src/agent_memory_triggers/db.py: -------------------------------------------------------------------------------- 1 | import gel 2 | 3 | gel_client = gel.create_async_client() 4 | 5 | async def get_gel(): 6 | try: 7 | yield gel_client 8 | finally: 9 | pass 10 | -------------------------------------------------------------------------------- /agent-memory-triggers/src/agent_memory_triggers/main.py: -------------------------------------------------------------------------------- 1 | from fastapi import FastAPI 2 | from fastapi.middleware.cors import CORSMiddleware 3 | from dotenv import load_dotenv 4 | 5 | load_dotenv() 6 | 7 | from agent_memory_triggers.routers import chat_api, agent_api 8 | 9 | 10 | app = FastAPI() 11 | app.add_middleware( 12 | CORSMiddleware, 13 | allow_origins=["localhost:8501"], 14 | allow_credentials=True, 15 | allow_methods=["*"], 16 | allow_headers=["*"], 17 | ) 18 | 19 | app.include_router(chat_api.router) 20 | app.include_router(agent_api.router) 21 | -------------------------------------------------------------------------------- /agent-memory-triggers/src/agent_memory_triggers/queries/delete.edgeql: -------------------------------------------------------------------------------- 1 | delete Resource; 2 | delete Prompt; 3 | delete Fact; 4 | delete Chat; 5 | delete Message; -------------------------------------------------------------------------------- /agent-memory-triggers/src/agent_memory_triggers/routers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/agent-memory-triggers/src/agent_memory_triggers/routers/__init__.py -------------------------------------------------------------------------------- /cloudflare-workers/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 140, 3 | "singleQuote": true, 4 | "semi": true, 5 | "useTabs": true 6 | } 7 | -------------------------------------------------------------------------------- /cloudflare-workers/README.md: -------------------------------------------------------------------------------- 1 | # Cloudflare Workers with EdgeDB — Example 2 | 3 | ## Local development 4 | 5 | Set env variables in the `wrangler.toml` file. 6 | 7 | ``` 8 | EDGEDB_DSN= 9 | ``` 10 | 11 | You can obtain your EdgeDB DSN from the command line by running: 12 | 13 | ```sh 14 | $ edgedb instance credentials --insecure-dsn 15 | ``` 16 | 17 | Install dependencies: 18 | 19 | ```sh 20 | pnpm i # npm i # yarn 21 | ``` 22 | 23 | Start Worker locally: 24 | 25 | ```sh 26 | npx wrnagler dev 27 | ``` 28 | 29 | ## Deployment 30 | 31 | ```sh 32 | npx wrnagler deploy 33 | ``` 34 | -------------------------------------------------------------------------------- /cloudflare-workers/dbschema/default.esdl: -------------------------------------------------------------------------------- 1 | module default { 2 | type Movie { 3 | required title: str { 4 | constraint exclusive; 5 | }; 6 | multi actors: Person; 7 | } 8 | 9 | type Person { 10 | required name: str; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /cloudflare-workers/dbschema/migrations/00001.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1eyguovjnuvvepgjdh5rhhwm54obpo7no456jx6meod6rgm5bofoq 2 | ONTO initial 3 | { 4 | CREATE TYPE default::Person { 5 | CREATE REQUIRED PROPERTY name: std::str; 6 | }; 7 | CREATE TYPE default::Movie { 8 | CREATE MULTI LINK actors: default::Person; 9 | CREATE REQUIRED PROPERTY title: std::str { 10 | CREATE CONSTRAINT std::exclusive; 11 | }; 12 | }; 13 | }; 14 | -------------------------------------------------------------------------------- /cloudflare-workers/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "4.5" 3 | -------------------------------------------------------------------------------- /cloudflare-workers/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cloudflare-edgedb", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "deploy": "wrangler deploy", 7 | "dev": "wrangler dev", 8 | "start": "wrangler dev", 9 | "types": "wrangler types" 10 | }, 11 | "devDependencies": { 12 | "@cloudflare/workers-types": "^4.20240208.0", 13 | "@edgedb/generate": "^0.4.1", 14 | "typescript": "^5.0.4", 15 | "wrangler": "^3.0.0" 16 | }, 17 | "dependencies": { 18 | "edgedb": "^1.4.1" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /cloudflare-workers/src/index.ts: -------------------------------------------------------------------------------- 1 | import * as edgedb from 'edgedb'; 2 | 3 | export default { 4 | async fetch(_request: Request, env: Env, ctx: ExecutionContext): Promise { 5 | const client = edgedb.createHttpClient({ 6 | tlsSecurity: 'insecure', 7 | dsn: env.EDGEDB_DSN, 8 | }); 9 | const movies = await client.query(` 10 | select Movie { 11 | title 12 | } 13 | `); 14 | 15 | return new Response(JSON.stringify(movies, null, 2), { 16 | headers: { 17 | 'content-type': 'application/json;charset=UTF-8', 18 | }, 19 | }); 20 | }, 21 | } satisfies ExportedHandler; 22 | -------------------------------------------------------------------------------- /cloudflare-workers/worker-configuration.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by Wrangler on Tue Feb 13 2024 20:37:01 GMT+0100 (GMT+01:00) 2 | interface Env { 3 | EDGEDB_DSN: ""; 4 | } 5 | -------------------------------------------------------------------------------- /cloudflare-workers/wrangler.toml: -------------------------------------------------------------------------------- 1 | name = "cloudflare-edgedb" 2 | main = "src/index.ts" 3 | compatibility_date = "2024-02-08" 4 | node_compat = true 5 | 6 | [vars] 7 | EDGEDB_DSN = "" 8 | -------------------------------------------------------------------------------- /deno-fresh/.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | dbschema/edgeql-js -------------------------------------------------------------------------------- /deno-fresh/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "deno.enable": true 3 | } -------------------------------------------------------------------------------- /deno-fresh/dbschema/default.esdl: -------------------------------------------------------------------------------- 1 | module default { 2 | type Count { 3 | property created_at -> datetime { 4 | default := datetime_of_transaction(); 5 | } 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /deno-fresh/dbschema/migrations/00001.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1h4u4dofpaxsi2guowyqnssoebuno5xjenx7arhbkix4xutraolxq 2 | ONTO initial 3 | { 4 | CREATE SCALAR TYPE default::counter EXTENDING std::sequence; 5 | }; 6 | -------------------------------------------------------------------------------- /deno-fresh/dbschema/migrations/00002.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1kfcgk2amm2daild6mzcfjqmrk5wqwotvmxphze5x7fpf7fwcvtwa 2 | ONTO m1h4u4dofpaxsi2guowyqnssoebuno5xjenx7arhbkix4xutraolxq 3 | { 4 | CREATE TYPE default::Count { 5 | CREATE PROPERTY created_at -> std::datetime { 6 | SET default := (std::datetime_of_transaction()); 7 | }; 8 | }; 9 | DROP SCALAR TYPE default::counter; 10 | }; 11 | -------------------------------------------------------------------------------- /deno-fresh/deno.json: -------------------------------------------------------------------------------- 1 | { 2 | "tasks": { 3 | "start": "deno run -A --unstable --watch=static/,routes/ dev.ts", 4 | "test": "deno run -A --unstable test.ts", 5 | "generate": "deno run --reload -A --unstable https://deno.land/x/edgedb/generate.ts" 6 | }, 7 | "importMap": "./import_map.json" 8 | } -------------------------------------------------------------------------------- /deno-fresh/dev.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S deno run -A --watch=static/,routes/ 2 | 3 | import dev from "$fresh/dev.ts"; 4 | 5 | await dev(import.meta.url, "./main.ts"); 6 | -------------------------------------------------------------------------------- /deno-fresh/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "2.0" 3 | -------------------------------------------------------------------------------- /deno-fresh/fresh.gen.ts: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file is generated by fresh. 2 | // This file SHOULD be checked into source version control. 3 | // This file is automatically updated during development when running `dev.ts`. 4 | 5 | import * as $0 from "./routes/index.tsx"; 6 | import * as $$0 from "./islands/Counter.tsx"; 7 | 8 | const manifest = { 9 | routes: { 10 | "./routes/index.tsx": $0, 11 | }, 12 | islands: { 13 | "./islands/Counter.tsx": $$0, 14 | }, 15 | baseUrl: import.meta.url, 16 | }; 17 | 18 | export default manifest; 19 | -------------------------------------------------------------------------------- /deno-fresh/import_map.json: -------------------------------------------------------------------------------- 1 | { 2 | "imports": { 3 | "$fresh/": "https://deno.land/x/fresh@1.0.0/", 4 | "preact": "https://esm.sh/preact@10.8.1", 5 | "preact/": "https://esm.sh/preact@10.8.1/", 6 | "preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.0?deps=preact@10.8.1", 7 | "edgedb": "https://deno.land/x/edgedb/mod.ts", 8 | "edgedb/": "https://deno.land/x/edgedb/" 9 | } 10 | } -------------------------------------------------------------------------------- /deno-fresh/islands/Counter.tsx: -------------------------------------------------------------------------------- 1 | /** @jsx h */ 2 | import {h} from 'preact'; 3 | import {IS_BROWSER} from '$fresh/runtime.ts'; 4 | 5 | interface CounterProps { 6 | value: number; 7 | } 8 | 9 | export default function Counter(props: CounterProps) { 10 | return ( 11 |
12 |

{props.value}

13 |
14 | 17 |
18 |
19 | {' '} 20 | 23 |
24 |
25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /deno-fresh/main.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | 7 | import { start } from "$fresh/server.ts"; 8 | import manifest from "./fresh.gen.ts"; 9 | await start(manifest); 10 | -------------------------------------------------------------------------------- /deno-fresh/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/deno-fresh/static/favicon.ico -------------------------------------------------------------------------------- /deno-fresh/test.ts: -------------------------------------------------------------------------------- 1 | import {createClient} from 'edgedb'; 2 | 3 | import e from './dbschema/edgeql-js/index.ts'; 4 | 5 | const client = createClient(); 6 | const query = e.select({ 7 | num: e.int64(35), 8 | msg: e.str('Hello world'), 9 | }); 10 | 11 | const result = await query.run(client); 12 | console.log(JSON.stringify(result, null, 2)); 13 | 14 | Deno.exit(); 15 | -------------------------------------------------------------------------------- /docs-chatbot/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /docs-chatbot/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env*.local 29 | 30 | # vercel 31 | .vercel 32 | 33 | # typescript 34 | *.tsbuildinfo 35 | next-env.d.ts 36 | 37 | dbschema/edgeql-js 38 | -------------------------------------------------------------------------------- /docs-chatbot/app/constants.ts: -------------------------------------------------------------------------------- 1 | export const errors = { 2 | flagged: `OpenAI has declined to answer your question due to their 3 | [usage-policies](https://openai.com/policies/usage-policies). Please try 4 | another question.`, 5 | default: "There was an error processing your request. Please try again.", 6 | }; 7 | -------------------------------------------------------------------------------- /docs-chatbot/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/docs-chatbot/app/favicon.ico -------------------------------------------------------------------------------- /docs-chatbot/app/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | :root { 6 | --foreground-rgb: 0, 0, 0; 7 | --background-start-rgb: 214, 219, 220; 8 | --background-end-rgb: 255, 255, 255; 9 | } 10 | 11 | @media (prefers-color-scheme: dark) { 12 | :root { 13 | --foreground-rgb: 255, 255, 255; 14 | --background-start-rgb: 0, 0, 0; 15 | --background-end-rgb: 0, 0, 0; 16 | } 17 | } 18 | 19 | body { 20 | color: rgb(var(--foreground-rgb)); 21 | background: linear-gradient( 22 | to bottom, 23 | transparent, 24 | rgb(var(--background-end-rgb)) 25 | ) 26 | rgb(var(--background-start-rgb)); 27 | } 28 | -------------------------------------------------------------------------------- /docs-chatbot/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import "./globals.css"; 2 | import { Inter } from "next/font/google"; 3 | 4 | const inter = Inter({ subsets: ["latin"] }); 5 | 6 | export const metadata = { 7 | title: "Documentation Chatbot", 8 | description: 9 | "Next.js app using OpenAI APIs and EdgeDB to create a chatbot that answers questions about documentation", 10 | }; 11 | 12 | export default function RootLayout({ 13 | children, 14 | }: { 15 | children: React.ReactNode; 16 | }) { 17 | return ( 18 | 19 | {children} 20 | 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /docs-chatbot/dbschema/default.esdl: -------------------------------------------------------------------------------- 1 | using extension pgvector; 2 | 3 | module default { 4 | scalar type OpenAIEmbedding extending 5 | ext::pgvector::vector<1536>; 6 | 7 | type Section { 8 | required content: str; 9 | required tokens: int16; 10 | required embedding: OpenAIEmbedding; 11 | 12 | index ext::pgvector::ivfflat_cosine(lists := 1) 13 | on (.embedding); 14 | } 15 | } -------------------------------------------------------------------------------- /docs-chatbot/dbschema/migrations/00001.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1avnhpvno7ishotp3qknxnjsuhxhhmnnjpmon75jzv75ukze57b5a 2 | ONTO initial 3 | { 4 | CREATE EXTENSION pgvector VERSION '0.4'; 5 | CREATE SCALAR TYPE default::OpenAIEmbedding EXTENDING ext::pgvector::vector<1536>; 6 | CREATE TYPE default::Section { 7 | CREATE REQUIRED PROPERTY embedding: default::OpenAIEmbedding; 8 | CREATE INDEX ext::pgvector::ivfflat_cosine(lists := 1) ON (.embedding); 9 | CREATE REQUIRED PROPERTY content: std::str; 10 | CREATE REQUIRED PROPERTY tokens: std::int16; 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /docs-chatbot/docs/edgeql/overview.md: -------------------------------------------------------------------------------- 1 | # EdgeQL 2 | 3 | EdgeQL is a next-generation query language designed to match SQL in power and surpass it in terms of clarity, brevity, and intuitiveness. It’s used to query the database, insert/update/delete data, modify/introspect the schema, manage transactions, and more. 4 | -------------------------------------------------------------------------------- /docs-chatbot/docs/edgeql/try-edgeql.md: -------------------------------------------------------------------------------- 1 | # Follow along 2 | 3 | The best way to learn EdgeQL is to play with it! Use the online EdgeQL shell (at https://www.edgedb.com/tutorial) to execute any and all EdgeQL snippets in the following pages. Or follow the Quickstart (at https://edgedb.com/docs/intro/quickstart) to spin up an EdgeDB instance on your computer, then open an interactive shell by typing edgedb. 4 | -------------------------------------------------------------------------------- /docs-chatbot/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "3.2" 3 | -------------------------------------------------------------------------------- /docs-chatbot/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = {}; 3 | 4 | module.exports = nextConfig; 5 | -------------------------------------------------------------------------------- /docs-chatbot/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /docs-chatbot/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs-chatbot/tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: [ 4 | './pages/**/*.{js,ts,jsx,tsx,mdx}', 5 | './components/**/*.{js,ts,jsx,tsx,mdx}', 6 | './app/**/*.{js,ts,jsx,tsx,mdx}', 7 | ], 8 | theme: { 9 | extend: { 10 | backgroundImage: { 11 | 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))', 12 | 'gradient-conic': 13 | 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))', 14 | }, 15 | }, 16 | }, 17 | plugins: [], 18 | } 19 | -------------------------------------------------------------------------------- /docs-chatbot/types/sse.d.ts: -------------------------------------------------------------------------------- 1 | type SSEOptions = EventSourceInit & { 2 | payload?: string; 3 | }; 4 | 5 | declare module "sse.js" { 6 | class SSE extends EventSource { 7 | constructor(url: string | URL, sseOptions?: SSEOptions); 8 | stream(): void; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /docs-chatbot/utils.ts: -------------------------------------------------------------------------------- 1 | import OpenAI from "openai"; 2 | 3 | export function initOpenAIClient() { 4 | if (!process.env.OPENAI_API_KEY) 5 | throw new Error("Missing environment variable OPENAI_API_KEY"); 6 | 7 | return new OpenAI({ 8 | apiKey: process.env.OPENAI_API_KEY, 9 | }); 10 | } 11 | -------------------------------------------------------------------------------- /drizzle-book-notes-app/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.* 7 | .yarn/* 8 | !.yarn/patches 9 | !.yarn/plugins 10 | !.yarn/releases 11 | !.yarn/versions 12 | 13 | # testing 14 | /coverage 15 | 16 | # next.js 17 | /.next/ 18 | /out/ 19 | 20 | # production 21 | /build 22 | 23 | # misc 24 | .DS_Store 25 | *.pem 26 | 27 | # debug 28 | npm-debug.log* 29 | yarn-debug.log* 30 | yarn-error.log* 31 | .pnpm-debug.log* 32 | 33 | # env files (can opt-in for committing if needed) 34 | .env* 35 | 36 | # vercel 37 | .vercel 38 | 39 | # typescript 40 | *.tsbuildinfo 41 | next-env.d.ts 42 | -------------------------------------------------------------------------------- /drizzle-book-notes-app/app/books/add/page.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import BookForm from "@/src/components/BookForm"; 4 | 5 | 6 | export default function AddBookPage() { 7 | return ( 8 |
9 |

Add New Book

10 | 11 |
12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /drizzle-book-notes-app/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/drizzle-book-notes-app/app/favicon.ico -------------------------------------------------------------------------------- /drizzle-book-notes-app/app/globals.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | 3 | :root { 4 | --background: #ffffff; 5 | --foreground: #171717; 6 | } 7 | 8 | @theme inline { 9 | --color-background: var(--background); 10 | --color-foreground: var(--foreground); 11 | --font-sans: var(--font-geist-sans); 12 | --font-mono: var(--font-geist-mono); 13 | } 14 | 15 | @media (prefers-color-scheme: dark) { 16 | :root { 17 | --background: #0a0a0a; 18 | --foreground: #ededed; 19 | } 20 | } 21 | 22 | body { 23 | background: var(--background); 24 | color: var(--foreground); 25 | font-family: Arial, Helvetica, sans-serif; 26 | } 27 | -------------------------------------------------------------------------------- /drizzle-book-notes-app/dbschema/default.gel: -------------------------------------------------------------------------------- 1 | module default { 2 | type Book { 3 | required title: str; 4 | author: str; 5 | year: int16; 6 | genre: str; 7 | read_date: datetime; 8 | 9 | # Relationship to notes 10 | multi notes := . ({ 5 | book: one(book, { 6 | fields: [note.bookId], 7 | references: [book.id] 8 | }), 9 | })); 10 | 11 | export const bookRelations = relations(book, ({many}) => ({ 12 | notes: many(note), 13 | })); -------------------------------------------------------------------------------- /drizzle-book-notes-app/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import { dirname } from "path"; 2 | import { fileURLToPath } from "url"; 3 | import { FlatCompat } from "@eslint/eslintrc"; 4 | 5 | const __filename = fileURLToPath(import.meta.url); 6 | const __dirname = dirname(__filename); 7 | 8 | const compat = new FlatCompat({ 9 | baseDirectory: __dirname, 10 | }); 11 | 12 | const eslintConfig = [ 13 | ...compat.extends("next/core-web-vitals", "next/typescript"), 14 | ]; 15 | 16 | export default eslintConfig; 17 | -------------------------------------------------------------------------------- /drizzle-book-notes-app/gel.toml: -------------------------------------------------------------------------------- 1 | watch = [] 2 | 3 | [instance] 4 | server-version = "6.4" 5 | 6 | 7 | [hooks] 8 | after_migration_apply = [ 9 | "npx drizzle-kit pull" 10 | ] 11 | -------------------------------------------------------------------------------- /drizzle-book-notes-app/next.config.ts: -------------------------------------------------------------------------------- 1 | import type { NextConfig } from "next"; 2 | 3 | const nextConfig: NextConfig = { 4 | /* config options here */ 5 | }; 6 | 7 | export default nextConfig; 8 | -------------------------------------------------------------------------------- /drizzle-book-notes-app/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | const config = { 2 | plugins: ["@tailwindcss/postcss"], 3 | }; 4 | 5 | export default config; 6 | -------------------------------------------------------------------------------- /drizzle-book-notes-app/public/file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /drizzle-book-notes-app/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /drizzle-book-notes-app/public/window.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /express-auth/.gitignore: -------------------------------------------------------------------------------- 1 | ######################################### 2 | # TypeScript / JS / NodeJS 3 | ######################################### 4 | 5 | # dependencies 6 | /node_modules 7 | /.pnp 8 | .pnp.js 9 | 10 | # testing 11 | /coverage 12 | 13 | # next.js 14 | /.next/ 15 | /out/ 16 | 17 | # production 18 | /build 19 | 20 | # misc 21 | .DS_Store 22 | *.pem 23 | 24 | # debug 25 | npm-debug.log* 26 | yarn-debug.log* 27 | yarn-error.log* 28 | 29 | # local env files 30 | .env.development.local 31 | .env.test.local 32 | .env.production.local 33 | 34 | # vercel 35 | .vercel 36 | 37 | *.db 38 | 39 | dbschema/edgeql-js -------------------------------------------------------------------------------- /express-auth/db.ts: -------------------------------------------------------------------------------- 1 | import { createClient } from "edgedb"; 2 | 3 | export const client = createClient(); 4 | -------------------------------------------------------------------------------- /express-auth/dbschema/migrations/00001.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1pht25sdxgo7tw3loovimnppi7v6schpwpp2moqirw2seuib66r6a 2 | ONTO initial 3 | { 4 | CREATE EXTENSION pgcrypto VERSION '1.3'; 5 | CREATE EXTENSION auth VERSION '1.0'; 6 | CREATE TYPE default::User { 7 | CREATE REQUIRED LINK identity: ext::auth::Identity; 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /express-auth/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "4.2" 3 | -------------------------------------------------------------------------------- /fastapi-crud-auth/.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | extend-exclude = 3 | .git, 4 | __pycache__, 5 | docs/source/conf.py, 6 | old, 7 | build, 8 | dist, 9 | .venv, 10 | venv, 11 | myvenv, 12 | app/queries 13 | 14 | extend-ignore = E203, E266, E501, W605 15 | 16 | # Black's default line length. 17 | max-line-length = 88 18 | 19 | max-complexity = 18 20 | 21 | # Specify the list of error codes you wish Flake8 to report. 22 | select = B,C,E,F,W,T4,B9 23 | 24 | # Parallelism 25 | jobs = 4 26 | -------------------------------------------------------------------------------- /fastapi-crud-auth/.gitignore: -------------------------------------------------------------------------------- 1 | myvenv -------------------------------------------------------------------------------- /fastapi-crud-auth/README.md: -------------------------------------------------------------------------------- 1 | ## FastAPI 2 | 3 | Before using the app, run `make setup` to prep environment, install dependencies, and generate code. Run `make dev-server` to start a development server. 4 | 5 | To switch to the app's virtual environment in an interactive terminal session, run `source myvenv/bin/activate`. 6 | 7 | To learn how to build this app yourself, check out [our guide](https://www.edgedb.com/docs/guides/tutorials/rest_apis_with_fastapi). 8 | -------------------------------------------------------------------------------- /fastapi-crud-auth/app/__init__.py: -------------------------------------------------------------------------------- 1 | import edgedb 2 | from fastapi import Request 3 | 4 | 5 | def get_edgedb_client(request: Request) -> edgedb.AsyncIOClient: 6 | return request.app.state.edgedb 7 | -------------------------------------------------------------------------------- /fastapi-crud-auth/app/queries/create_event.edgeql: -------------------------------------------------------------------------------- 1 | with name := $name, 2 | address := $address, 3 | schedule := $schedule, 4 | host_name := $host_name 5 | 6 | select ( 7 | insert Event { 8 | name := name, 9 | address := address, 10 | schedule := schedule, 11 | host := assert_single( 12 | (select detached User filter .name = host_name) 13 | ) 14 | } 15 | ) {name, address, schedule, host: {name}}; 16 | -------------------------------------------------------------------------------- /fastapi-crud-auth/app/queries/create_user.edgeql: -------------------------------------------------------------------------------- 1 | select (insert User {name:=$name}) {name, created_at}; 2 | -------------------------------------------------------------------------------- /fastapi-crud-auth/app/queries/delete_event.edgeql: -------------------------------------------------------------------------------- 1 | select ( 2 | delete Event filter .name = $name 3 | ) {name, address, schedule, host : {name}}; 4 | -------------------------------------------------------------------------------- /fastapi-crud-auth/app/queries/delete_user.edgeql: -------------------------------------------------------------------------------- 1 | select ( 2 | delete User filter .name = $name 3 | ) {name, created_at}; 4 | -------------------------------------------------------------------------------- /fastapi-crud-auth/app/queries/get_event_by_name.edgeql: -------------------------------------------------------------------------------- 1 | select Event { 2 | name, address, schedule, 3 | host : {name} 4 | } filter .name=$name; 5 | -------------------------------------------------------------------------------- /fastapi-crud-auth/app/queries/get_events.edgeql: -------------------------------------------------------------------------------- 1 | select Event {name, address, schedule, host : {name}}; 2 | -------------------------------------------------------------------------------- /fastapi-crud-auth/app/queries/get_user_by_name.edgeql: -------------------------------------------------------------------------------- 1 | select User {name, created_at} filter User.name=$name 2 | -------------------------------------------------------------------------------- /fastapi-crud-auth/app/queries/get_users.edgeql: -------------------------------------------------------------------------------- 1 | select User {name, created_at}; 2 | -------------------------------------------------------------------------------- /fastapi-crud-auth/app/queries/update_event.edgeql: -------------------------------------------------------------------------------- 1 | with current_name := $current_name, 2 | new_name := $name, 3 | address := $address, 4 | schedule := $schedule, 5 | host_name := $host_name 6 | 7 | select ( 8 | update Event filter .name = current_name 9 | set { 10 | name := new_name, 11 | address := address, 12 | schedule := schedule, 13 | host := (select User filter .name = host_name) 14 | } 15 | ) {name, address, schedule, host: {name}}; 16 | -------------------------------------------------------------------------------- /fastapi-crud-auth/app/queries/update_user.edgeql: -------------------------------------------------------------------------------- 1 | select ( 2 | update User filter .name = $current_name 3 | set {name := $new_name} 4 | ) {name, created_at}; 5 | -------------------------------------------------------------------------------- /fastapi-crud-auth/dbschema/migrations/00002.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1o44fg65rqgafacgqgue2hlahzddj6ilapw6gmmgf6ckx56n7bxuq 2 | ONTO m1ztaehexxjhdnba7m7xbmdvmfeir6z37ehrnxkylg7obpdo6gqzfa 3 | { 4 | ALTER TYPE default::Event { 5 | ALTER PROPERTY name { 6 | CREATE CONSTRAINT std::max_len_value(50); 7 | }; 8 | }; 9 | ALTER TYPE default::User { 10 | ALTER PROPERTY name { 11 | CREATE CONSTRAINT std::max_len_value(50); 12 | }; 13 | }; 14 | }; 15 | -------------------------------------------------------------------------------- /fastapi-crud-auth/dbschema/migrations/00003.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1dubpo33vtnoby5ynceil2qir2rede56kfx5n2pmpgw7xob2p6k5q 2 | ONTO m1o44fg65rqgafacgqgue2hlahzddj6ilapw6gmmgf6ckx56n7bxuq 3 | { 4 | ALTER TYPE default::User { 5 | ALTER PROPERTY name { 6 | CREATE CONSTRAINT std::exclusive; 7 | }; 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /fastapi-crud-auth/dbschema/migrations/00004.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1oe66ebzkfe3pjwiq2yxr6pmfdp5ltnv3hdhzb5snicxaiz3yjvaq 2 | ONTO m1dubpo33vtnoby5ynceil2qir2rede56kfx5n2pmpgw7xob2p6k5q 3 | { 4 | ALTER TYPE default::Event { 5 | ALTER LINK host { 6 | SET REQUIRED USING (SELECT 7 | default::User 8 | FILTER 9 | (.name = 'string') 10 | ); 11 | }; 12 | }; 13 | }; 14 | -------------------------------------------------------------------------------- /fastapi-crud-auth/dbschema/migrations/00005.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1dbl7go74lax7a3a7knyduto3ivka4jxfyzcexvzzhozc7ycftada 2 | ONTO m1oe66ebzkfe3pjwiq2yxr6pmfdp5ltnv3hdhzb5snicxaiz3yjvaq 3 | { 4 | ALTER TYPE default::Event { 5 | ALTER LINK host { 6 | RESET OPTIONALITY; 7 | }; 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /fastapi-crud-auth/dbschema/migrations/00006.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m16r77gz27jqnlos6std4s2ich5ecmxkidbe5vrel2jef23trmtpia 2 | ONTO m1dbl7go74lax7a3a7knyduto3ivka4jxfyzcexvzzhozc7ycftada 3 | { 4 | ALTER TYPE default::AuditLog RENAME TO default::Auditable; 5 | }; 6 | -------------------------------------------------------------------------------- /fastapi-crud-auth/dbschema/migrations/00007.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m12kcgdxpnqoh7uekkvmp3wvhhqwod3qyz7psn7y5wtne3wln6yefa 2 | ONTO m16r77gz27jqnlos6std4s2ich5ecmxkidbe5vrel2jef23trmtpia 3 | { 4 | ALTER TYPE default::Auditable { 5 | ALTER PROPERTY created_at { 6 | SET readonly := true; 7 | }; 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /fastapi-crud-auth/dbschema/migrations/00008.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1iql6m25k74sq2o4432ettotupltggdib5q7b54svxzcfycfi3xia 2 | ONTO m12kcgdxpnqoh7uekkvmp3wvhhqwod3qyz7psn7y5wtne3wln6yefa 3 | { 4 | ALTER TYPE default::Auditable { 5 | ALTER ANNOTATION std::description := "Add 'created_at' property to all types."; 6 | ALTER PROPERTY created_at { 7 | SET REQUIRED USING (std::datetime_current()); 8 | }; 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /fastapi-crud-auth/dbschema/migrations/00009-m1co2rs.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1co2rsosgepnjltxdv47gcdsawsfrjang4kwebko5c5oqugxrtnua 2 | ONTO m1iql6m25k74sq2o4432ettotupltggdib5q7b54svxzcfycfi3xia 3 | { 4 | CREATE EXTENSION pgcrypto VERSION '1.3'; 5 | CREATE EXTENSION auth VERSION '1.0'; 6 | }; 7 | -------------------------------------------------------------------------------- /fastapi-crud-auth/dbschema/migrations/00010-m1gme45.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1gme45vmspnh7htkkqp627x4ksu7g2hgwchbpzcf6vvlu2fcie3yq 2 | ONTO m1co2rsosgepnjltxdv47gcdsawsfrjang4kwebko5c5oqugxrtnua 3 | { 4 | ALTER TYPE default::User { 5 | CREATE REQUIRED LINK identity: ext::auth::Identity { 6 | SET REQUIRED USING ({}); 7 | }; 8 | }; 9 | CREATE GLOBAL default::current_user := (std::assert_single((SELECT 10 | default::User { 11 | id, 12 | name 13 | } 14 | FILTER 15 | (.identity = GLOBAL ext::auth::ClientTokenIdentity) 16 | ))); 17 | }; 18 | -------------------------------------------------------------------------------- /fastapi-crud-auth/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "4.4" 3 | -------------------------------------------------------------------------------- /fastapi-crud-auth/pyproject.toml: -------------------------------------------------------------------------------- 1 | # Linter configuruation. 2 | [tool.isort] 3 | profile = "black" 4 | atomic = true 5 | extend_skip_glob = "migrations,scripts,app/queries,myvenv,tests" 6 | line_length = 88 7 | 8 | 9 | [tool.black] 10 | extend-exclude = "migrations,scripts" 11 | force-exclude = "app/queries/.*|tests" 12 | 13 | 14 | [tool.mypy] 15 | follow_imports = "skip" 16 | ignore_missing_imports = true 17 | warn_no_return = false 18 | warn_unused_ignores = true 19 | allow_untyped_globals = true 20 | allow_redefinition = true 21 | pretty = true 22 | exclude = "myvenv" 23 | 24 | 25 | [[tool.mypy.overrides]] 26 | module = "tests.*" 27 | ignore_errors = true 28 | 29 | [tool.pytest.ini_options] 30 | asyncio_mode = "auto" 31 | -------------------------------------------------------------------------------- /fastapi-crud-auth/scripts/health_check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | source myvenv/bin/activate 6 | # Run the uvicorn server in the background. 7 | 8 | nohup uvicorn app.main:fast_api --port 5001 --reload >> /dev/null & 9 | 10 | # Give the server enough time to be ready before accepting requests. 11 | sleep 2 12 | 13 | # Run the healthcheck. 14 | if [[ $(httpx -m GET http://localhost:5001/health_check 2>&1) =~ "200 OK" ]]; then 15 | echo "Health check passed!" 16 | exit 0 17 | else 18 | echo "Health check failed!" 19 | exit 1 20 | fi 21 | 22 | # Cleanup. 23 | pkill -9 -ecfi python 24 | -------------------------------------------------------------------------------- /fastapi-crud-auth/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/fastapi-crud-auth/tests/__init__.py -------------------------------------------------------------------------------- /fastapi-crud-auth/tests/fixture.edgeql: -------------------------------------------------------------------------------- 1 | insert User {name := 'Jonathan Harker'}; 2 | insert User {name := 'Count Dracula'}; 3 | insert User {name := 'Mina Murray'}; 4 | insert Event { 5 | name := 'Resuscitation', 6 | host := (select User filter .name = 'Mina Murray'), 7 | address := 'Britain', 8 | schedule := '1889-07-28T06:59:59+00:00' 9 | }; 10 | -------------------------------------------------------------------------------- /fastapi-crud/.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | extend-exclude = 3 | .git, 4 | __pycache__, 5 | docs/source/conf.py, 6 | old, 7 | build, 8 | dist, 9 | .venv, 10 | venv, 11 | myvenv, 12 | app/queries 13 | 14 | extend-ignore = E203, E266, E501, W605 15 | 16 | # Black's default line length. 17 | max-line-length = 88 18 | 19 | max-complexity = 18 20 | 21 | # Specify the list of error codes you wish Flake8 to report. 22 | select = B,C,E,F,W,T4,B9 23 | 24 | # Parallelism 25 | jobs = 4 26 | -------------------------------------------------------------------------------- /fastapi-crud/.gitignore: -------------------------------------------------------------------------------- 1 | myvenv -------------------------------------------------------------------------------- /fastapi-crud/README.md: -------------------------------------------------------------------------------- 1 | ## FastAPI 2 | 3 | Before using the app, run `make setup` to prep environment, install dependencies, and generate code. Run `make dev-server` to start a development server. 4 | 5 | To switch to the app's virtual environment in an interactive terminal session, run `source myvenv/bin/activate`. 6 | 7 | To learn how to build this app yourself, check out [our guide](https://www.edgedb.com/docs/guides/tutorials/rest_apis_with_fastapi). 8 | -------------------------------------------------------------------------------- /fastapi-crud/app/__init__.py: -------------------------------------------------------------------------------- 1 | import edgedb 2 | from fastapi import Request 3 | 4 | 5 | def get_edgedb_client(request: Request) -> edgedb.AsyncIOClient: 6 | return request.app.state.edgedb 7 | -------------------------------------------------------------------------------- /fastapi-crud/app/queries/create_event.edgeql: -------------------------------------------------------------------------------- 1 | with name := $name, 2 | address := $address, 3 | schedule := $schedule, 4 | host_name := $host_name 5 | 6 | select ( 7 | insert Event { 8 | name := name, 9 | address := address, 10 | schedule := schedule, 11 | host := assert_single( 12 | (select detached User filter .name = host_name) 13 | ) 14 | } 15 | ) {name, address, schedule, host: {name}}; 16 | -------------------------------------------------------------------------------- /fastapi-crud/app/queries/create_user.edgeql: -------------------------------------------------------------------------------- 1 | select (insert User {name:=$name}) {name, created_at}; 2 | -------------------------------------------------------------------------------- /fastapi-crud/app/queries/delete_event.edgeql: -------------------------------------------------------------------------------- 1 | select ( 2 | delete Event filter .name = $name 3 | ) {name, address, schedule, host : {name}}; 4 | -------------------------------------------------------------------------------- /fastapi-crud/app/queries/delete_user.edgeql: -------------------------------------------------------------------------------- 1 | select ( 2 | delete User filter .name = $name 3 | ) {name, created_at}; 4 | -------------------------------------------------------------------------------- /fastapi-crud/app/queries/get_event_by_name.edgeql: -------------------------------------------------------------------------------- 1 | select Event { 2 | name, address, schedule, 3 | host : {name} 4 | } filter .name=$name; 5 | -------------------------------------------------------------------------------- /fastapi-crud/app/queries/get_events.edgeql: -------------------------------------------------------------------------------- 1 | select Event {name, address, schedule, host : {name}}; 2 | -------------------------------------------------------------------------------- /fastapi-crud/app/queries/get_user_by_name.edgeql: -------------------------------------------------------------------------------- 1 | select User {name, created_at} filter User.name=$name 2 | -------------------------------------------------------------------------------- /fastapi-crud/app/queries/get_users.edgeql: -------------------------------------------------------------------------------- 1 | select User {name, created_at}; 2 | -------------------------------------------------------------------------------- /fastapi-crud/app/queries/update_event.edgeql: -------------------------------------------------------------------------------- 1 | with current_name := $current_name, 2 | new_name := $name, 3 | address := $address, 4 | schedule := $schedule, 5 | host_name := $host_name 6 | 7 | select ( 8 | update Event filter .name = current_name 9 | set { 10 | name := new_name, 11 | address := address, 12 | schedule := schedule, 13 | host := (select User filter .name = host_name) 14 | } 15 | ) {name, address, schedule, host: {name}}; 16 | -------------------------------------------------------------------------------- /fastapi-crud/app/queries/update_user.edgeql: -------------------------------------------------------------------------------- 1 | select ( 2 | update User filter .name = $current_name 3 | set {name := $new_name} 4 | ) {name, created_at}; 5 | -------------------------------------------------------------------------------- /fastapi-crud/dbschema/migrations/00002.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1o44fg65rqgafacgqgue2hlahzddj6ilapw6gmmgf6ckx56n7bxuq 2 | ONTO m1ztaehexxjhdnba7m7xbmdvmfeir6z37ehrnxkylg7obpdo6gqzfa 3 | { 4 | ALTER TYPE default::Event { 5 | ALTER PROPERTY name { 6 | CREATE CONSTRAINT std::max_len_value(50); 7 | }; 8 | }; 9 | ALTER TYPE default::User { 10 | ALTER PROPERTY name { 11 | CREATE CONSTRAINT std::max_len_value(50); 12 | }; 13 | }; 14 | }; 15 | -------------------------------------------------------------------------------- /fastapi-crud/dbschema/migrations/00003.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1dubpo33vtnoby5ynceil2qir2rede56kfx5n2pmpgw7xob2p6k5q 2 | ONTO m1o44fg65rqgafacgqgue2hlahzddj6ilapw6gmmgf6ckx56n7bxuq 3 | { 4 | ALTER TYPE default::User { 5 | ALTER PROPERTY name { 6 | CREATE CONSTRAINT std::exclusive; 7 | }; 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /fastapi-crud/dbschema/migrations/00004.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1oe66ebzkfe3pjwiq2yxr6pmfdp5ltnv3hdhzb5snicxaiz3yjvaq 2 | ONTO m1dubpo33vtnoby5ynceil2qir2rede56kfx5n2pmpgw7xob2p6k5q 3 | { 4 | ALTER TYPE default::Event { 5 | ALTER LINK host { 6 | SET REQUIRED USING (SELECT 7 | default::User 8 | FILTER 9 | (.name = 'string') 10 | ); 11 | }; 12 | }; 13 | }; 14 | -------------------------------------------------------------------------------- /fastapi-crud/dbschema/migrations/00005.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1dbl7go74lax7a3a7knyduto3ivka4jxfyzcexvzzhozc7ycftada 2 | ONTO m1oe66ebzkfe3pjwiq2yxr6pmfdp5ltnv3hdhzb5snicxaiz3yjvaq 3 | { 4 | ALTER TYPE default::Event { 5 | ALTER LINK host { 6 | RESET OPTIONALITY; 7 | }; 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /fastapi-crud/dbschema/migrations/00006.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m16r77gz27jqnlos6std4s2ich5ecmxkidbe5vrel2jef23trmtpia 2 | ONTO m1dbl7go74lax7a3a7knyduto3ivka4jxfyzcexvzzhozc7ycftada 3 | { 4 | ALTER TYPE default::AuditLog RENAME TO default::Auditable; 5 | }; 6 | -------------------------------------------------------------------------------- /fastapi-crud/dbschema/migrations/00007.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m12kcgdxpnqoh7uekkvmp3wvhhqwod3qyz7psn7y5wtne3wln6yefa 2 | ONTO m16r77gz27jqnlos6std4s2ich5ecmxkidbe5vrel2jef23trmtpia 3 | { 4 | ALTER TYPE default::Auditable { 5 | ALTER PROPERTY created_at { 6 | SET readonly := true; 7 | }; 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /fastapi-crud/dbschema/migrations/00008.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1iql6m25k74sq2o4432ettotupltggdib5q7b54svxzcfycfi3xia 2 | ONTO m12kcgdxpnqoh7uekkvmp3wvhhqwod3qyz7psn7y5wtne3wln6yefa 3 | { 4 | ALTER TYPE default::Auditable { 5 | ALTER ANNOTATION std::description := "Add 'created_at' property to all types."; 6 | ALTER PROPERTY created_at { 7 | SET REQUIRED USING (std::datetime_current()); 8 | }; 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /fastapi-crud/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "4.4" 3 | -------------------------------------------------------------------------------- /fastapi-crud/pyproject.toml: -------------------------------------------------------------------------------- 1 | # Linter configuruation. 2 | [tool.isort] 3 | profile = "black" 4 | atomic = true 5 | extend_skip_glob = "migrations,scripts,app/queries,myvenv,tests" 6 | line_length = 88 7 | 8 | 9 | [tool.black] 10 | extend-exclude = "migrations,scripts" 11 | force-exclude = "app/queries/.*|tests" 12 | 13 | 14 | [tool.mypy] 15 | follow_imports = "skip" 16 | ignore_missing_imports = true 17 | warn_no_return = false 18 | warn_unused_ignores = true 19 | allow_untyped_globals = true 20 | allow_redefinition = true 21 | pretty = true 22 | exclude = "myvenv" 23 | 24 | 25 | [[tool.mypy.overrides]] 26 | module = "tests.*" 27 | ignore_errors = true 28 | 29 | [tool.pytest.ini_options] 30 | asyncio_mode = "auto" 31 | -------------------------------------------------------------------------------- /fastapi-crud/scripts/health_check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | source myvenv/bin/activate 6 | # Run the uvicorn server in the background. 7 | 8 | nohup uvicorn app.main:fast_api --port 5001 --reload >> /dev/null & 9 | 10 | # Give the server enough time to be ready before accepting requests. 11 | sleep 2 12 | 13 | # Run the healthcheck. 14 | if [[ $(httpx -m GET http://localhost:5001/health_check 2>&1) =~ "200 OK" ]]; then 15 | echo "Health check passed!" 16 | exit 0 17 | else 18 | echo "Health check failed!" 19 | exit 1 20 | fi 21 | 22 | # Cleanup. 23 | pkill -9 -ecfi python 24 | -------------------------------------------------------------------------------- /fastapi-crud/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/fastapi-crud/tests/__init__.py -------------------------------------------------------------------------------- /fastapi-crud/tests/fixture.edgeql: -------------------------------------------------------------------------------- 1 | insert User {name := 'Jonathan Harker'}; 2 | insert User {name := 'Count Dracula'}; 3 | insert User {name := 'Mina Murray'}; 4 | insert Event { 5 | name := 'Resuscitation', 6 | host := (select User filter .name = 'Mina Murray'), 7 | address := 'Britain', 8 | schedule := '1889-07-28T06:59:59+00:00' 9 | }; 10 | -------------------------------------------------------------------------------- /fastapi-gelai/.gitignore: -------------------------------------------------------------------------------- 1 | # Python-generated files 2 | __pycache__/ 3 | *.py[oc] 4 | build/ 5 | dist/ 6 | wheels/ 7 | *.egg-info 8 | 9 | # Virtual environments 10 | .venv 11 | -------------------------------------------------------------------------------- /fastapi-gelai/.python-version: -------------------------------------------------------------------------------- 1 | 3.13 2 | -------------------------------------------------------------------------------- /fastapi-gelai/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/fastapi-gelai/README.md -------------------------------------------------------------------------------- /fastapi-gelai/app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/fastapi-gelai/app/__init__.py -------------------------------------------------------------------------------- /fastapi-gelai/app/queries/add_message.edgeql: -------------------------------------------------------------------------------- 1 | with 2 | user := (select User filter .name = $username), 3 | update Chat 4 | filter .id = $chat_id and .$message_role, 9 | body := $message_body, 10 | sources := array_unpack(>$sources) 11 | } 12 | )) 13 | } 14 | -------------------------------------------------------------------------------- /fastapi-gelai/app/queries/create_chat.edgeql: -------------------------------------------------------------------------------- 1 | with new_chat := (insert Chat) 2 | select ( 3 | update User filter .name = $username 4 | set { 5 | chats := assert_distinct(.chats union new_chat) 6 | } 7 | ) { 8 | new_chat_id := new_chat.id 9 | } 10 | -------------------------------------------------------------------------------- /fastapi-gelai/app/queries/create_user.edgeql: -------------------------------------------------------------------------------- 1 | select( 2 | insert User { 3 | name := $username 4 | } 5 | ) { 6 | name 7 | } 8 | 9 | -------------------------------------------------------------------------------- /fastapi-gelai/app/queries/get_chat_by_id.edgeql: -------------------------------------------------------------------------------- 1 | select Chat { 2 | messages: { role, body, sources } , 3 | user := .$username and .id = $chat_id; 5 | -------------------------------------------------------------------------------- /fastapi-gelai/app/queries/get_chats.edgeql: -------------------------------------------------------------------------------- 1 | select Chat { 2 | messages: { role, body, sources }, 3 | user := .$username; 5 | -------------------------------------------------------------------------------- /fastapi-gelai/app/queries/get_messages.edgeql: -------------------------------------------------------------------------------- 1 | with 2 | user := (select User filter .name = $username), 3 | chat := ( 4 | select Chat filter .$chat_id 5 | ) 6 | select Message { 7 | role, 8 | body, 9 | sources, 10 | chat := .$name; 3 | 4 | -------------------------------------------------------------------------------- /fastapi-gelai/app/queries/get_users.edgeql: -------------------------------------------------------------------------------- 1 | select User { name }; 2 | -------------------------------------------------------------------------------- /fastapi-gelai/app/queries/search_chats.edgeql: -------------------------------------------------------------------------------- 1 | with 2 | user := (select User filter .name = $username), 3 | chats := ( 4 | select Chat 5 | filter .$current_chat_id 7 | ) 8 | 9 | select chats { 10 | distance := min( 11 | ext::ai::search( 12 | .messages, 13 | >$embedding, 14 | ).distance, 15 | ), 16 | messages: { 17 | role, body, sources 18 | } 19 | } 20 | 21 | order by .distance 22 | limit $limit; 23 | 24 | -------------------------------------------------------------------------------- /fastapi-gelai/dbschema/default.esdl: -------------------------------------------------------------------------------- 1 | using extension ai; 2 | 3 | module default { 4 | type Message { 5 | role: str; 6 | body: str; 7 | timestamp: datetime { 8 | default := datetime_current(); 9 | } 10 | multi sources: str; 11 | 12 | deferred index ext::ai::index(embedding_model := 'text-embedding-3-small') 13 | on (.body); 14 | 15 | } 16 | 17 | type Chat { 18 | multi messages: Message; 19 | } 20 | 21 | type User { 22 | name: str { 23 | constraint exclusive; 24 | } 25 | multi chats: Chat; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /fastapi-gelai/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "5.7" 3 | -------------------------------------------------------------------------------- /fastapi-gelai/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "searchbot" 3 | version = "0.1.0" 4 | description = "Add your description here" 5 | readme = "README.md" 6 | requires-python = ">=3.13" 7 | dependencies = [ 8 | "beautifulsoup4>=4.12.3", 9 | "edgedb>=2.2.0", 10 | "fastapi[standard]>=0.115.7", 11 | "googlesearch-python>=1.3.0", 12 | "httpx-sse>=0.4.0", 13 | "openai>=1.60.2", 14 | "python-dotenv>=1.0.1", 15 | "requests>=2.32.3", 16 | ] 17 | 18 | [project.optional-dependencies] 19 | standard = [ 20 | "fastapi>=0.115.7", 21 | ] 22 | -------------------------------------------------------------------------------- /flask-crud/.editorconfig: -------------------------------------------------------------------------------- 1 | # https://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | indent_style = space 7 | indent_size = 2 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | charset = utf-8 11 | end_of_line = lf 12 | 13 | [*.{py,md}] 14 | indent_size = 4 15 | 16 | [Makefile] 17 | indent_size = 4 18 | indent_style = tab 19 | -------------------------------------------------------------------------------- /flask-crud/.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | extend-exclude = 3 | .git, 4 | __pycache__, 5 | docs/source/conf.py, 6 | old, 7 | build, 8 | dist, 9 | .venv, 10 | venv 11 | 12 | extend-ignore = E203, E266, E501, W605 13 | 14 | # Black's default line length. 15 | max-line-length = 88 16 | 17 | max-complexity = 18 18 | 19 | # Specify the list of error codes you wish Flake8 to report. 20 | select = B,C,E,F,W,T4,B9 21 | 22 | # Parallelism 23 | jobs = 4 24 | -------------------------------------------------------------------------------- /flask-crud/.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # See https://pre-commit.com for more information 2 | # See https://pre-commit.com/hooks.html for more hooks 3 | repos: 4 | - repo: https://github.com/pre-commit/pre-commit-hooks 5 | rev: v4.0.1 6 | hooks: 7 | - id: trailing-whitespace 8 | - id: end-of-file-fixer 9 | - id: check-yaml 10 | - id: check-added-large-files 11 | 12 | - repo: local 13 | hooks: 14 | - id: lint 15 | name: Run Black Isort Mypy Flake8 16 | entry: make lint 17 | language: system 18 | types: [python] 19 | -------------------------------------------------------------------------------- /flask-crud/README.md: -------------------------------------------------------------------------------- 1 | ## Flask 2 | 3 | Read the tutorial [here](https://www.edgedb.com/docs/guides/tutorials/rest_apis_with_flask). 4 | -------------------------------------------------------------------------------- /flask-crud/app/main.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from http import HTTPStatus 4 | 5 | from flask import Flask 6 | 7 | from app.actors import actor 8 | from app.movies import movie 9 | 10 | app = Flask(__name__) 11 | 12 | app.register_blueprint(actor) 13 | app.register_blueprint(movie) 14 | 15 | 16 | @app.get("/health_check") 17 | def health_check() -> tuple[dict, int]: 18 | return {"status": "Ok"}, HTTPStatus.OK 19 | -------------------------------------------------------------------------------- /flask-crud/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "2.0" 3 | -------------------------------------------------------------------------------- /flask-crud/pyproject.toml: -------------------------------------------------------------------------------- 1 | # Linter configuruation. 2 | [tool.isort] 3 | profile = "black" 4 | atomic = true 5 | extend_skip_glob = "migrations,scripts" 6 | line_length = 88 7 | 8 | 9 | [tool.black] 10 | extend-exclude = "migrations,scripts" 11 | 12 | 13 | [tool.mypy] 14 | follow_imports = "skip" 15 | ignore_missing_imports = true 16 | warn_no_return = false 17 | warn_unused_ignores = true 18 | allow_untyped_globals = true 19 | allow_redefinition = true 20 | pretty = true 21 | 22 | 23 | [[tool.mypy.overrides]] 24 | module = "tests.*" 25 | ignore_errors = true 26 | -------------------------------------------------------------------------------- /flask-crud/requirements-dev.in: -------------------------------------------------------------------------------- 1 | # For linting. 2 | black 3 | flake8 4 | isort 5 | mypy 6 | pre-commit 7 | 8 | # For dep management. 9 | pip-tools 10 | 11 | # For testing. 12 | pytest 13 | -------------------------------------------------------------------------------- /flask-crud/requirements.in: -------------------------------------------------------------------------------- 1 | edgedb 2 | flask 3 | httpx[cli] 4 | -------------------------------------------------------------------------------- /flask-crud/scripts/health_check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # Run the uvicorn server in the background. 6 | export FLASK_APP=app.main:app 7 | nohup flask run --reload >> /dev/null & 8 | 9 | # Give the server enough time to be ready before accepting requests. 10 | sleep 2 11 | 12 | # Run the healthcheck. 13 | if [[ $(httpx -m GET http://localhost:5000/health_check 2>&1) =~ "200 OK" ]]; then 14 | echo "Health check passed!" 15 | exit 0 16 | else 17 | echo "Health check failed!" 18 | exit 1 19 | fi 20 | 21 | # Cleanup. 22 | pkill -9 -ecfi python 23 | -------------------------------------------------------------------------------- /flask-proxy/.editorconfig: -------------------------------------------------------------------------------- 1 | # https://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | indent_style = space 7 | indent_size = 2 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | charset = utf-8 11 | end_of_line = lf 12 | 13 | [*.{py,md}] 14 | indent_size = 4 15 | 16 | [Makefile] 17 | indent_size = 4 18 | indent_style = tab 19 | -------------------------------------------------------------------------------- /flask-proxy/.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | extend-exclude = 3 | .git, 4 | __pycache__, 5 | docs/source/conf.py, 6 | old, 7 | build, 8 | dist, 9 | .venv, 10 | venv 11 | 12 | extend-ignore = E203, E266, E501, W605 13 | 14 | # Black's default line length. 15 | max-line-length = 88 16 | 17 | max-complexity = 18 18 | 19 | # Specify the list of error codes you wish Flake8 to report. 20 | select = B,C,E,F,W,T4,B9 21 | 22 | # Parallelism 23 | jobs = 4 24 | -------------------------------------------------------------------------------- /flask-proxy/.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # See https://pre-commit.com for more information 2 | # See https://pre-commit.com/hooks.html for more hooks 3 | repos: 4 | - repo: https://github.com/pre-commit/pre-commit-hooks 5 | rev: v4.0.1 6 | hooks: 7 | - id: trailing-whitespace 8 | - id: end-of-file-fixer 9 | - id: check-yaml 10 | - id: check-added-large-files 11 | 12 | - repo: local 13 | hooks: 14 | - id: lint 15 | name: Run Black Isort Mypy Flake8 16 | entry: make lint 17 | language: system 18 | types: [python] 19 | -------------------------------------------------------------------------------- /flask-proxy/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "2.0" 3 | -------------------------------------------------------------------------------- /flask-proxy/pyproject.toml: -------------------------------------------------------------------------------- 1 | # Linter configuruation. 2 | [tool.isort] 3 | profile = "black" 4 | atomic = true 5 | extend_skip_glob = "migrations,scripts" 6 | line_length = 88 7 | 8 | 9 | [tool.black] 10 | extend-exclude = "migrations,scripts" 11 | 12 | 13 | [tool.mypy] 14 | follow_imports = "skip" 15 | ignore_missing_imports = true 16 | warn_no_return = false 17 | warn_unused_ignores = true 18 | allow_untyped_globals = true 19 | allow_redefinition = true 20 | check_untyped_defs = true 21 | disallow_any_generics = true 22 | pretty = true 23 | 24 | 25 | [[tool.mypy.overrides]] 26 | module = "tests.*" 27 | ignore_errors = true 28 | -------------------------------------------------------------------------------- /flask-proxy/requirements-dev.in: -------------------------------------------------------------------------------- 1 | # For linting. 2 | black 3 | flake8 4 | isort 5 | mypy 6 | pre-commit 7 | types-requests 8 | 9 | # For dep management. 10 | pip-tools 11 | 12 | # For testing. 13 | pytest 14 | -------------------------------------------------------------------------------- /flask-proxy/requirements.in: -------------------------------------------------------------------------------- 1 | flask 2 | authlib 3 | requests 4 | pyjwt 5 | edgedb==0.24.0a5 6 | -------------------------------------------------------------------------------- /flutter/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /flutter/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter/android/app/src/main/kotlin/com/example/flutter_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.flutter_example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /flutter/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /flutter/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /flutter/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /flutter/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 6 | -------------------------------------------------------------------------------- /flutter/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /flutter/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "2.3" 3 | -------------------------------------------------------------------------------- /flutter/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /flutter/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /flutter/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /flutter/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /flutter/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /flutter/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /flutter/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /flutter/lib/getNRandomMovies.edgeql: -------------------------------------------------------------------------------- 1 | select Movie { 2 | title 3 | } 4 | order by random() 5 | limit $n -------------------------------------------------------------------------------- /flutter/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /flutter/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /flutter/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /flutter/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /flutter/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /flutter/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /flutter/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /flutter/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /flutter/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | 9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 10 | } 11 | -------------------------------------------------------------------------------- /flutter/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /flutter/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /flutter/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = flutter_example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterExample 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /flutter/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /flutter/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /flutter/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /flutter/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /flutter/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /flutter/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/web/favicon.png -------------------------------------------------------------------------------- /flutter/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/web/icons/Icon-192.png -------------------------------------------------------------------------------- /flutter/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/web/icons/Icon-512.png -------------------------------------------------------------------------------- /flutter/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /flutter/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /flutter/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /flutter/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /flutter/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /flutter/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /flutter/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/flutter/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /go-workout/01-workouts/dbschema/default.esdl: -------------------------------------------------------------------------------- 1 | module default { 2 | type Workout { 3 | required property started_at -> datetime { 4 | constraint exclusive; 5 | default := datetime_current(); 6 | } 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /go-workout/01-workouts/dbschema/migrations/00001.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1zpyolps7fxv4762t3z7hbweosqefu6amqbmm66ogxefugo7xqnaq 2 | ONTO initial 3 | { 4 | CREATE TYPE default::Workout { 5 | CREATE REQUIRED PROPERTY started_at -> std::datetime { 6 | SET default := (std::datetime_current()); 7 | CREATE CONSTRAINT std::exclusive; 8 | }; 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /go-workout/01-workouts/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "2.3" 3 | -------------------------------------------------------------------------------- /go-workout/01-workouts/frontend/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /public/build/ 3 | 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /go-workout/01-workouts/frontend/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/go-workout/01-workouts/frontend/public/favicon.png -------------------------------------------------------------------------------- /go-workout/01-workouts/frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Svelte app 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /go-workout/01-workouts/frontend/src/App.svelte: -------------------------------------------------------------------------------- 1 | 20 | 21 | 22 |
23 | 24 |
25 | 26 | -------------------------------------------------------------------------------- /go-workout/01-workouts/frontend/src/main.js: -------------------------------------------------------------------------------- 1 | import App from './App.svelte'; 2 | 3 | const app = new App({ target: document.body }); 4 | 5 | export default app; 6 | -------------------------------------------------------------------------------- /go-workout/01-workouts/frontend/src/pages/Index.svelte: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 |

Workout History

22 | 23 |
24 | 25 |
26 | 27 | {#each workouts as workout} 28 |

29 | {workout.started_at} 30 |

31 | {/each} 32 | -------------------------------------------------------------------------------- /go-workout/01-workouts/frontend/src/pages/Workout.svelte: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 |

Workout

16 | 17 |

18 | started at {workout.started_at} 19 |

20 | -------------------------------------------------------------------------------- /go-workout/01-workouts/frontend/src/routes.js: -------------------------------------------------------------------------------- 1 | import Index from './pages/Index.svelte' 2 | import Workout from './pages/Workout.svelte' 3 | 4 | export default [ 5 | { 6 | path: '/', 7 | component: Index, 8 | }, 9 | { 10 | path: '/workout/:id', 11 | component: Workout, 12 | }, 13 | ] 14 | -------------------------------------------------------------------------------- /go-workout/01-workouts/internal/db/db.go: -------------------------------------------------------------------------------- 1 | package db 2 | 3 | import ( 4 | "context" 5 | "log" 6 | 7 | "github.com/edgedb/edgedb-go" 8 | ) 9 | 10 | var Pool = connect() 11 | 12 | func connect() *edgedb.Client { 13 | ctx := context.Background() 14 | pool, err := edgedb.CreateClient(ctx, edgedb.Options{}) 15 | if err != nil { 16 | log.Fatal(err) 17 | } 18 | 19 | return pool 20 | } 21 | -------------------------------------------------------------------------------- /go-workout/01-workouts/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/edgedb/edgedb-examples/go-workout/internal/workout" 5 | "github.com/gin-gonic/gin" 6 | ) 7 | 8 | func main() { 9 | r := gin.Default() 10 | 11 | r.POST("/api/workout", workout.Create) 12 | r.GET("/api/workout", workout.ReadMany) 13 | r.GET("/api/workout/:id", workout.Read) 14 | 15 | r.Run() 16 | } 17 | -------------------------------------------------------------------------------- /go-workout/02-exercise/dbschema/default.esdl: -------------------------------------------------------------------------------- 1 | module default { 2 | type Workout { 3 | required property started_at -> datetime { 4 | constraint exclusive; 5 | default := datetime_current(); 6 | } 7 | } 8 | 9 | type Exercise { 10 | required property name -> str { 11 | constraint exclusive; 12 | constraint min_len_value(1); 13 | }; 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /go-workout/02-exercise/dbschema/migrations/00001.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1zpyolps7fxv4762t3z7hbweosqefu6amqbmm66ogxefugo7xqnaq 2 | ONTO initial 3 | { 4 | CREATE TYPE default::Workout { 5 | CREATE REQUIRED PROPERTY started_at -> std::datetime { 6 | SET default := (std::datetime_current()); 7 | CREATE CONSTRAINT std::exclusive; 8 | }; 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /go-workout/02-exercise/dbschema/migrations/00002.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1jer2wyoe47tiwmf2tm75vl7fw6oapk2endloz2vkwsdwnb4ugavq 2 | ONTO m1zpyolps7fxv4762t3z7hbweosqefu6amqbmm66ogxefugo7xqnaq 3 | { 4 | CREATE TYPE default::Exercise { 5 | CREATE REQUIRED PROPERTY name -> std::str { 6 | CREATE CONSTRAINT std::exclusive; 7 | CREATE CONSTRAINT std::min_len_value(1); 8 | }; 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /go-workout/02-exercise/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "2.3" 3 | -------------------------------------------------------------------------------- /go-workout/02-exercise/frontend/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /public/build/ 3 | 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /go-workout/02-exercise/frontend/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/go-workout/02-exercise/frontend/public/favicon.png -------------------------------------------------------------------------------- /go-workout/02-exercise/frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Svelte app 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /go-workout/02-exercise/frontend/src/App.svelte: -------------------------------------------------------------------------------- 1 | 20 | 21 | 22 |
23 | Workouts | 24 | Exercises 25 | 26 | 27 |
28 | 29 | -------------------------------------------------------------------------------- /go-workout/02-exercise/frontend/src/main.js: -------------------------------------------------------------------------------- 1 | import App from './App.svelte'; 2 | 3 | const app = new App({ target: document.body }); 4 | 5 | export default app; 6 | -------------------------------------------------------------------------------- /go-workout/02-exercise/frontend/src/pages/Index.svelte: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 |

Workout History

22 | 23 |
24 | 25 |
26 | 27 | {#each workouts as workout} 28 |

29 | {workout.started_at} 30 |

31 | {/each} 32 | -------------------------------------------------------------------------------- /go-workout/02-exercise/frontend/src/pages/Workout.svelte: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 |

Workout

16 | 17 |

18 | started at {workout.started_at} 19 |

20 | -------------------------------------------------------------------------------- /go-workout/02-exercise/frontend/src/routes.js: -------------------------------------------------------------------------------- 1 | import Index from './pages/Index.svelte' 2 | import Workout from './pages/Workout.svelte' 3 | import Exercise from './pages/Exercise.svelte' 4 | 5 | export default [ 6 | { 7 | path: '/', 8 | component: Index, 9 | }, 10 | { 11 | path: '/workout/:id', 12 | component: Workout, 13 | }, 14 | { 15 | path: '/exercises', 16 | component: Exercise, 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /go-workout/02-exercise/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/edgedb/edgedb-examples/go-workout 2 | 3 | go 1.16 4 | 5 | require ( 6 | github.com/edgedb/edgedb-go v0.8.2 7 | github.com/gin-gonic/gin v1.6.3 8 | github.com/xdg/scram v1.0.3 // indirect 9 | github.com/xdg/stringprep v1.0.3 // indirect 10 | golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect 11 | golang.org/x/text v0.3.6 // indirect 12 | ) 13 | -------------------------------------------------------------------------------- /go-workout/02-exercise/internal/db/db.go: -------------------------------------------------------------------------------- 1 | package db 2 | 3 | import ( 4 | "context" 5 | "log" 6 | 7 | "github.com/edgedb/edgedb-go" 8 | ) 9 | 10 | var Pool = connect() 11 | 12 | func connect() *edgedb.Client { 13 | ctx := context.Background() 14 | pool, err := edgedb.CreateClient(ctx, edgedb.Options{}) 15 | if err != nil { 16 | log.Fatal(err) 17 | } 18 | 19 | return pool 20 | } 21 | -------------------------------------------------------------------------------- /go-workout/02-exercise/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/edgedb/edgedb-examples/go-workout/internal/exercise" 5 | "github.com/edgedb/edgedb-examples/go-workout/internal/workout" 6 | "github.com/gin-gonic/gin" 7 | ) 8 | 9 | func main() { 10 | r := gin.Default() 11 | 12 | r.POST("/api/workout", workout.Create) 13 | r.GET("/api/workout", workout.ReadMany) 14 | r.GET("/api/workout/:id", workout.Read) 15 | 16 | r.POST("/api/exercise", exercise.Create) 17 | r.GET("/api/exercise", exercise.ReadMany) 18 | r.PUT("/api/exercise", exercise.Update) 19 | 20 | r.Run() 21 | } 22 | -------------------------------------------------------------------------------- /go-workout/03-sets/dbschema/migrations/00001.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1zpyolps7fxv4762t3z7hbweosqefu6amqbmm66ogxefugo7xqnaq 2 | ONTO initial 3 | { 4 | CREATE TYPE default::Workout { 5 | CREATE REQUIRED PROPERTY started_at -> std::datetime { 6 | SET default := (std::datetime_current()); 7 | CREATE CONSTRAINT std::exclusive; 8 | }; 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /go-workout/03-sets/dbschema/migrations/00002.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1jer2wyoe47tiwmf2tm75vl7fw6oapk2endloz2vkwsdwnb4ugavq 2 | ONTO m1zpyolps7fxv4762t3z7hbweosqefu6amqbmm66ogxefugo7xqnaq 3 | { 4 | CREATE TYPE default::Exercise { 5 | CREATE REQUIRED PROPERTY name -> std::str { 6 | CREATE CONSTRAINT std::exclusive; 7 | CREATE CONSTRAINT std::min_len_value(1); 8 | }; 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /go-workout/03-sets/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "2.3" 3 | -------------------------------------------------------------------------------- /go-workout/03-sets/frontend/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /public/build/ 3 | 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /go-workout/03-sets/frontend/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/go-workout/03-sets/frontend/public/favicon.png -------------------------------------------------------------------------------- /go-workout/03-sets/frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Svelte app 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /go-workout/03-sets/frontend/src/App.svelte: -------------------------------------------------------------------------------- 1 | 20 | 21 | 22 |
23 | Workouts | 24 | Exercises 25 | 26 | 27 |
28 | 29 | -------------------------------------------------------------------------------- /go-workout/03-sets/frontend/src/main.js: -------------------------------------------------------------------------------- 1 | import App from './App.svelte'; 2 | 3 | const app = new App({ target: document.body }); 4 | 5 | export default app; 6 | -------------------------------------------------------------------------------- /go-workout/03-sets/frontend/src/pages/Index.svelte: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 |

Workout History

22 | 23 |
24 | 25 |
26 | 27 | {#each workouts as workout} 28 |

29 | {workout.started_at} 30 |

31 | {/each} 32 | -------------------------------------------------------------------------------- /go-workout/03-sets/frontend/src/routes.js: -------------------------------------------------------------------------------- 1 | import Index from './pages/Index.svelte' 2 | import Workout from './pages/Workout.svelte' 3 | import Exercise from './pages/Exercise.svelte' 4 | 5 | export default [ 6 | { 7 | path: '/', 8 | component: Index, 9 | }, 10 | { 11 | path: '/workout/:id', 12 | component: Workout, 13 | }, 14 | { 15 | path: '/exercises', 16 | component: Exercise, 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /go-workout/03-sets/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/edgedb/edgedb-examples/go-workout 2 | 3 | go 1.16 4 | 5 | require ( 6 | github.com/edgedb/edgedb-go v0.8.2 7 | github.com/gin-gonic/gin v1.6.3 8 | github.com/xdg/scram v1.0.3 // indirect 9 | github.com/xdg/stringprep v1.0.3 // indirect 10 | golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect 11 | golang.org/x/text v0.3.6 // indirect 12 | ) 13 | -------------------------------------------------------------------------------- /go-workout/03-sets/internal/db/db.go: -------------------------------------------------------------------------------- 1 | package db 2 | 3 | import ( 4 | "context" 5 | "log" 6 | 7 | "github.com/edgedb/edgedb-go" 8 | ) 9 | 10 | var Pool = connect() 11 | 12 | func connect() *edgedb.Client { 13 | ctx := context.Background() 14 | pool, err := edgedb.CreateClient(ctx, edgedb.Options{}) 15 | if err != nil { 16 | log.Fatal(err) 17 | } 18 | 19 | return pool 20 | } 21 | -------------------------------------------------------------------------------- /go-workout/03-sets/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/edgedb/edgedb-examples/go-workout/internal/exercise" 5 | "github.com/edgedb/edgedb-examples/go-workout/internal/set" 6 | "github.com/edgedb/edgedb-examples/go-workout/internal/workout" 7 | "github.com/gin-gonic/gin" 8 | ) 9 | 10 | func main() { 11 | r := gin.Default() 12 | 13 | r.POST("/api/workout", workout.Create) 14 | r.GET("/api/workout", workout.ReadMany) 15 | r.GET("/api/workout/:id", workout.Read) 16 | 17 | r.POST("/api/exercise", exercise.Create) 18 | r.GET("/api/exercise", exercise.ReadMany) 19 | r.PUT("/api/exercise", exercise.Update) 20 | 21 | r.POST("/api/set", set.Create) 22 | 23 | r.Run() 24 | } 25 | -------------------------------------------------------------------------------- /go-workout/README.md: -------------------------------------------------------------------------------- 1 | # EdgeDB Workout App Tutorial 2 | 3 | This tutorial walks through making a simple weight lifting log application using EdgeDB, go, and svelte. 4 | 5 | - [part 1](https://github.com/edgedb/edgedb-examples/tree/main/go-workout/blob/master/01-workouts/tutorial.md) 6 | - [part 2](https://github.com/edgedb/edgedb-examples/tree/main/go-workout/blob/master/02-exercise/tutorial.md) 7 | - [part 3](https://github.com/edgedb/edgedb-examples/tree/main/go-workout/blob/master/03-sets/tutorial.md) 8 | -------------------------------------------------------------------------------- /langchain-codegen/.gitignore: -------------------------------------------------------------------------------- 1 | docs -------------------------------------------------------------------------------- /langchain-codegen/dbschema/default.gel: -------------------------------------------------------------------------------- 1 | using extension pgvector; 2 | 3 | module default { 4 | scalar type EmbeddingVector extending ext::pgvector::vector<1536>; 5 | 6 | type Record { 7 | required collection: str; 8 | text: str; 9 | embedding: EmbeddingVector; 10 | external_id: str { 11 | constraint exclusive; 12 | }; 13 | metadata: json; 14 | 15 | index ext::pgvector::hnsw_cosine(m := 16, ef_construction := 128) 16 | on (.embedding) 17 | } 18 | } -------------------------------------------------------------------------------- /langchain-codegen/dbschema/scoping.gel: -------------------------------------------------------------------------------- 1 | # Use a simpler algorithm for resolving the scope of object names. 2 | # This behavior will become the default in Gel 7.0. 3 | # See: https://docs.edgedb.com/database/edgeql/path_resolution#new-path-scoping 4 | using future simple_scoping; 5 | -------------------------------------------------------------------------------- /langchain-codegen/gel.toml: -------------------------------------------------------------------------------- 1 | watch = [] 2 | 3 | [instance] 4 | server-version = "6.7" 5 | -------------------------------------------------------------------------------- /langchain-codegen/md_docs/intro/guides/ai/index.md: -------------------------------------------------------------------------------- 1 | # Adding AI 2 | 3 | -------------------------------------------------------------------------------- /langchain-codegen/md_docs/intro/guides/drizzle/index.md: -------------------------------------------------------------------------------- 1 | # Adding Drizzle ORM 2 | 3 | -------------------------------------------------------------------------------- /langchain-codegen/md_docs/intro/guides/index.md: -------------------------------------------------------------------------------- 1 | # Guides 2 | 3 | -------------------------------------------------------------------------------- /langchain-codegen/md_docs/intro/quickstart/ai/index.md: -------------------------------------------------------------------------------- 1 | # Adding AI 2 | 3 | -------------------------------------------------------------------------------- /langchain-codegen/md_docs/intro/quickstart/connecting/index.md: -------------------------------------------------------------------------------- 1 | # Connecting to the database 2 | 3 | -------------------------------------------------------------------------------- /langchain-codegen/md_docs/intro/quickstart/index.md: -------------------------------------------------------------------------------- 1 | # Quickstart 2 | 3 | -------------------------------------------------------------------------------- /langchain-codegen/md_docs/intro/quickstart/inheritance/index.md: -------------------------------------------------------------------------------- 1 | # Adding shared properties 2 | 3 | -------------------------------------------------------------------------------- /langchain-codegen/md_docs/intro/quickstart/modeling/index.md: -------------------------------------------------------------------------------- 1 | # Modeling the data 2 | 3 | -------------------------------------------------------------------------------- /langchain-codegen/md_docs/intro/quickstart/overview/index.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | -------------------------------------------------------------------------------- /langchain-codegen/md_docs/intro/quickstart/setup/index.md: -------------------------------------------------------------------------------- 1 | # Setting up your environment 2 | 3 | -------------------------------------------------------------------------------- /langchain-codegen/md_docs/intro/quickstart/working/fastapi.md: -------------------------------------------------------------------------------- 1 | # Working with the data 2 | 3 | In this section, you will update the existing FastAPI application to use Gel to store and query data, instead of a JSON file. Having a working application with mock data allows you to focus on learning how Gel works, without getting bogged down by the details of the application. 4 | 5 | ## Bulk importing of data 6 | 7 | ## Updating data 8 | 9 | ## Adding linked data 10 | 11 | ## Deleting linked data 12 | 13 | ## Querying data 14 | 15 | -------------------------------------------------------------------------------- /langchain-codegen/md_docs/intro/quickstart/working/index.md: -------------------------------------------------------------------------------- 1 | # Working with the data 2 | 3 | -------------------------------------------------------------------------------- /langchain-codegen/md_docs/intro/quickstart/working/nextjs.md: -------------------------------------------------------------------------------- 1 | # Working with the data 2 | 3 | In this section, you will update the existing application to use Gel to store and query data, instead of a static JSON file. Having a working application with mock data allows you to focus on learning how Gel works, without getting bogged down by the details of the application. 4 | 5 | ## Bulk importing of data 6 | 7 | ## Updating data 8 | 9 | ## Adding linked data 10 | 11 | ## Deleting linked data 12 | 13 | ## Querying data 14 | 15 | -------------------------------------------------------------------------------- /langchain-codegen/md_docs/intro/tutorials/index.md: -------------------------------------------------------------------------------- 1 | # Tutorials 2 | 3 | -------------------------------------------------------------------------------- /langchain-codegen/src/langchain_codegen/__init__.py: -------------------------------------------------------------------------------- 1 | def main() -> None: 2 | print("Hello from langchain-gel-codegen!") 3 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/dbschema/default.gel: -------------------------------------------------------------------------------- 1 | using extension pgvector; 2 | 3 | module default { 4 | scalar type EmbeddingVector extending ext::pgvector::vector<1536>; 5 | 6 | type Record { 7 | required collection: str; 8 | text: str; 9 | embedding: EmbeddingVector; 10 | external_id: str { 11 | constraint exclusive; 12 | }; 13 | metadata: json; 14 | 15 | index ext::pgvector::hnsw_cosine(m := 16, ef_construction := 128) 16 | on (.embedding) 17 | } 18 | 19 | 20 | type Plant { 21 | name: str; 22 | description: str; 23 | how_to_care: str; 24 | } 25 | } -------------------------------------------------------------------------------- /llamaindex-gel-helper/dbschema/scoping.gel: -------------------------------------------------------------------------------- 1 | # Use a simpler algorithm for resolving the scope of object names. 2 | # This behavior will become the default in Gel 7.0. 3 | # See: https://docs.edgedb.com/database/edgeql/path_resolution#new-path-scoping 4 | using future simple_scoping; 5 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/gel.toml: -------------------------------------------------------------------------------- 1 | watch = [] 2 | 3 | [instance] 4 | server-version = "6.7" 5 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/md_docs/intro/guides/ai/index.md: -------------------------------------------------------------------------------- 1 | # Adding AI 2 | 3 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/md_docs/intro/guides/drizzle/index.md: -------------------------------------------------------------------------------- 1 | # Adding Drizzle ORM 2 | 3 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/md_docs/intro/guides/index.md: -------------------------------------------------------------------------------- 1 | # Guides 2 | 3 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/md_docs/intro/quickstart/ai/index.md: -------------------------------------------------------------------------------- 1 | # Adding AI 2 | 3 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/md_docs/intro/quickstart/connecting/index.md: -------------------------------------------------------------------------------- 1 | # Connecting to the database 2 | 3 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/md_docs/intro/quickstart/index.md: -------------------------------------------------------------------------------- 1 | # Quickstart 2 | 3 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/md_docs/intro/quickstart/inheritance/index.md: -------------------------------------------------------------------------------- 1 | # Adding shared properties 2 | 3 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/md_docs/intro/quickstart/modeling/index.md: -------------------------------------------------------------------------------- 1 | # Modeling the data 2 | 3 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/md_docs/intro/quickstart/overview/index.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/md_docs/intro/quickstart/setup/index.md: -------------------------------------------------------------------------------- 1 | # Setting up your environment 2 | 3 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/md_docs/intro/quickstart/working/fastapi.md: -------------------------------------------------------------------------------- 1 | # Working with the data 2 | 3 | In this section, you will update the existing FastAPI application to use Gel to store and query data, instead of a JSON file. Having a working application with mock data allows you to focus on learning how Gel works, without getting bogged down by the details of the application. 4 | 5 | ## Bulk importing of data 6 | 7 | ## Updating data 8 | 9 | ## Adding linked data 10 | 11 | ## Deleting linked data 12 | 13 | ## Querying data 14 | 15 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/md_docs/intro/quickstart/working/index.md: -------------------------------------------------------------------------------- 1 | # Working with the data 2 | 3 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/md_docs/intro/quickstart/working/nextjs.md: -------------------------------------------------------------------------------- 1 | # Working with the data 2 | 3 | In this section, you will update the existing application to use Gel to store and query data, instead of a static JSON file. Having a working application with mock data allows you to focus on learning how Gel works, without getting bogged down by the details of the application. 4 | 5 | ## Bulk importing of data 6 | 7 | ## Updating data 8 | 9 | ## Adding linked data 10 | 11 | ## Deleting linked data 12 | 13 | ## Querying data 14 | 15 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/md_docs/intro/tutorials/index.md: -------------------------------------------------------------------------------- 1 | # Tutorials 2 | 3 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "llamaindex-gel-helper" 3 | version = "0.1.0" 4 | description = "Add your description here" 5 | readme = "README.md" 6 | authors = [ 7 | { name = "anbuzin", email = "contactbuzin@gmail.com" } 8 | ] 9 | requires-python = ">=3.13" 10 | dependencies = [ 11 | "gel>=3.1.0", 12 | "llama-index>=0.12.36", 13 | "llama-index-llms-openai>=0.3.38", 14 | "llama-index-vector-stores-gel>=0.1.0", 15 | "python-dotenv>=1.1.0", 16 | ] 17 | 18 | [project.scripts] 19 | gel-agent = "llamaindex_gel_helper:main" 20 | build-rag = "llamaindex_gel_helper.rag:main" 21 | 22 | [build-system] 23 | requires = ["hatchling"] 24 | build-backend = "hatchling.build" 25 | -------------------------------------------------------------------------------- /llamaindex-gel-helper/src/llamaindex_gel_helper/__init__.py: -------------------------------------------------------------------------------- 1 | from .agent import main as agent_main 2 | import asyncio 3 | 4 | def main() -> None: 5 | asyncio.run(agent_main()) 6 | -------------------------------------------------------------------------------- /nestjs-crud/.editorconfig: -------------------------------------------------------------------------------- 1 | # https://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | indent_style = space 7 | indent_size = 2 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | charset = utf-8 11 | end_of_line = lf 12 | 13 | [*.{py,md}] 14 | indent_size = 4 15 | 16 | [Makefile] 17 | indent_size = 4 18 | indent_style = tab 19 | -------------------------------------------------------------------------------- /nestjs-crud/.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json 36 | 37 | dbschema/edgeql-js 38 | -------------------------------------------------------------------------------- /nestjs-crud/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": false, 3 | "trailingComma": "all" 4 | } 5 | -------------------------------------------------------------------------------- /nestjs-crud/dbschema/migrations/00003.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1zhhtjnse6muychjq5ikafibpd3chyh6a4nrv3kg7xadhrrm5hy7a 2 | ONTO m1jpdkambyjpwefvdkwxk6zanbokogphprdhs2qwv3l4n5kw5qkqbq 3 | { 4 | ALTER TYPE default::Actor { 5 | DROP ANNOTATION std::description; 6 | DROP PROPERTY age; 7 | DROP PROPERTY height; 8 | DROP PROPERTY name; 9 | }; 10 | ALTER TYPE default::Auditable { 11 | DROP PROPERTY created_at; 12 | DROP ANNOTATION std::description; 13 | }; 14 | DROP TYPE default::Actor; 15 | DROP TYPE default::Auditable; 16 | }; 17 | -------------------------------------------------------------------------------- /nestjs-crud/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "2.0" 3 | -------------------------------------------------------------------------------- /nestjs-crud/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/nest-cli", 3 | "collection": "@nestjs/schematics", 4 | "sourceRoot": "src" 5 | } 6 | -------------------------------------------------------------------------------- /nestjs-crud/scripts/health_check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # Run the nestjs server in the background. 6 | npm run start:dev >> /dev/null & 7 | 8 | # Give the server enough time to be ready before accepting requests. 9 | # Dev server startup is slow!!! 10 | 11 | c=20 12 | while [[ $c != 0 ]] 13 | do 14 | # Run the healthcheck. 15 | if [[ $(curl -I http://localhost:3000/health-check 2>&1) =~ "200 OK" ]]; then 16 | echo "Health check passed!" 17 | exit 0 18 | fi 19 | ((c--)) 20 | echo "retrying" 21 | sleep 1 22 | done 23 | 24 | echo "Health check failed!" 25 | exit 1 26 | -------------------------------------------------------------------------------- /nestjs-crud/src/actor/actor.controller.spec.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/nestjs-crud/src/actor/actor.controller.spec.ts -------------------------------------------------------------------------------- /nestjs-crud/src/actor/actor.dto.ts: -------------------------------------------------------------------------------- 1 | import { IsNotEmpty, IsBoolean, IsInt } from "class-validator"; 2 | import { PartialType, OmitType } from "@nestjs/swagger"; 3 | 4 | export class CreateActorDto { 5 | @IsNotEmpty() 6 | name!: string; 7 | 8 | @IsInt() 9 | age?: number; 10 | 11 | @IsInt() 12 | height?: number; 13 | 14 | @IsBoolean() 15 | isDeceased?: boolean; 16 | } 17 | 18 | // We want to make the mandatory 'name' type optional during PUT request. 19 | // So, we'll remove it from the 'CreateActorDto' class and redefine it. 20 | class _UpdateActorDto extends OmitType(CreateActorDto, ["name"]) { 21 | name?: string; 22 | } 23 | 24 | export class UpdateActorDto extends PartialType(_UpdateActorDto) {} 25 | -------------------------------------------------------------------------------- /nestjs-crud/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from "@nestjs/common"; 2 | import { ActorController, HealthController } from "./actor/actor.controller"; 3 | import { ActorService } from "./actor/actor.service"; 4 | 5 | @Module({ 6 | imports: [], 7 | controllers: [ActorController, HealthController], 8 | providers: [ActorService], 9 | }) 10 | export class AppModule {} 11 | -------------------------------------------------------------------------------- /nestjs-crud/test/app.e2e-spec.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/nestjs-crud/test/app.e2e-spec.ts -------------------------------------------------------------------------------- /nestjs-crud/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /nestjs-crud/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /nestjs-crud/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "module": "CommonJS", 5 | "moduleResolution": "node", 6 | "outDir": "./dist", 7 | "baseUrl": "./", 8 | "declaration": true, 9 | "pretty": true, 10 | "removeComments": false, 11 | "incremental": true, 12 | "sourceMap": true, 13 | "strict": true, 14 | "downlevelIteration": true, 15 | "allowSyntheticDefaultImports": true, 16 | "skipLibCheck": true, 17 | "emitDecoratorMetadata": true, 18 | "esModuleInterop": true, 19 | "experimentalDecorators": true, 20 | "importHelpers": true, 21 | "paths": { 22 | "~/*": ["./src/*", "./generated/*"] 23 | } 24 | }, 25 | "exclude": ["**/node_modules", "**/dist"] 26 | } 27 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/.env.local: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_CLERK_FRONTEND_API=clerk.meet.platypus-17.lcl.dev 2 | CLERK_API_KEY=test_2UgDDaFUzQTaOH6Uec1Ao6CXAg4j1bbi3r 3 | CLERK_JWT_KEY=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoYzP1TxqYyE0RA7rNpfu4m22fnkpngyT7YR3Kj1Ifjec0T6fmdW2I9cVNYQzyYJHo6GfgRKy2J2xBkKXPGRdnkabmnPBVtwioEMrr3pnpaokelehRoPWs9tbqypAYEELKqc/Mbx7ngBns7iqwcEBv96el93FjW0Qqj+fOSmzfXq4vP9+nyFJDN0kRsm+2pLzHATcySf3hgbeaSCE4fZNz/UaELqHQ5lz3s1QGI0pqmhXhZeTyiSriyqOsIdC17dCxOVtw8zg92EYR7YQ3O6n4bE/LJ5twVikrrE7qX8gJVvDTiYVnT2q9yviJZV09uUVJ5iPijyv87UH5Vl8I246HQIDAQAB -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/.env.local.sample: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_CLERK_FRONTEND_API=your-frontend-api 2 | CLERK_API_KEY=your-api-key -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env.development.local 29 | .env.test.local 30 | .env.production.local 31 | 32 | # vercel 33 | .vercel 34 | .idea 35 | 36 | dbschema/edgeql-js 37 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { "printWidth": 120 } 2 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/client.js: -------------------------------------------------------------------------------- 1 | import { createClient } from "edgedb"; 2 | export const client = createClient(); 3 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/components/Layout.js: -------------------------------------------------------------------------------- 1 | import Header from './Header' 2 | 3 | const Layout = ({ children }) => ( 4 | <> 5 |
6 |
{children}
7 | 8 | ) 9 | 10 | export default Layout 11 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/dbschema/default.esdl: -------------------------------------------------------------------------------- 1 | module default { 2 | 3 | global current_user -> str; 4 | 5 | type User { 6 | required property clerk_id -> str { constraint exclusive }; 7 | multi link posts := . str; 12 | required link author -> User; 13 | access policy insert_posts allow insert; 14 | access policy own_posts allow select, delete, update using ( 15 | .author ?= (select User filter .clerk_id = global current_user) 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "2.0" 3 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/index.mjs: -------------------------------------------------------------------------------- 1 | import { createClient } from "edgedb"; 2 | const client = createClient(); 3 | 4 | async function run() { 5 | const result = await client 6 | .withGlobals({ 7 | current_user: "user_2CEIGykjL1BLw2JAfqANe33CQnZ", 8 | }) 9 | .query(`select User { id, clerk_id, posts := . ( 4 | 5 | ) 6 | 7 | export default SignInPage 8 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/pages/sign-up/[[...index]].js: -------------------------------------------------------------------------------- 1 | import { SignUp } from "@clerk/nextjs"; 2 | 3 | const SignUpPage = () => ( 4 | 5 | ); 6 | 7 | export default SignUpPage; 8 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/pages/user/[[...index]].js: -------------------------------------------------------------------------------- 1 | import { UserProfile } from '@clerk/nextjs' 2 | 3 | const UserProfilePage = () => 4 | 5 | export default UserProfilePage 6 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/nextjs-access-policies-clerk/public/favicon.ico -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/public/icons/arrow-right.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/public/icons/download.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/public/icons/external-link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/public/icons/layout.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/public/icons/shield-check.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/public/icons/sparkles.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/public/icons/user-plus.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/public/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/styles/Header.module.css: -------------------------------------------------------------------------------- 1 | .header { 2 | display: flex; 3 | justify-content: space-between; 4 | padding: 1rem; 5 | } 6 | 7 | .logo { 8 | display: flex; 9 | justify-content: center; 10 | align-items: center; 11 | } 12 | 13 | .appName { 14 | margin-left: 12px; 15 | font-weight: bold; 16 | color: #335bf1; 17 | } 18 | 19 | .left, 20 | .right { 21 | display: flex; 22 | align-items: center; 23 | } 24 | 25 | .right > :not(:first-child) { 26 | margin-left: 1rem; 27 | } 28 | 29 | @media screen and (min-width: 768px) { 30 | .header { 31 | padding: 1rem 2rem; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nextjs-access-policies-clerk/styles/globals.css: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600&display=swap'); 2 | 3 | html, 4 | body { 5 | font-family: 'Source Sans Pro', sans-serif; 6 | font-size: 16px; 7 | font-weight: 400; 8 | line-height: 20px; 9 | padding: 0; 10 | margin: 0; 11 | } 12 | 13 | a { 14 | color: inherit; 15 | text-decoration: none; 16 | } 17 | 18 | *, 19 | *:before, 20 | *:after { 21 | box-sizing: border-box; 22 | -webkit-font-smoothing: antialiased; 23 | -moz-osx-font-smoothing: grayscale; 24 | } 25 | -------------------------------------------------------------------------------- /nextjs-auth/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /nextjs-auth/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "4.2" 3 | -------------------------------------------------------------------------------- /nextjs-auth/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = {} 3 | 4 | module.exports = nextConfig 5 | -------------------------------------------------------------------------------- /nextjs-auth/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /nextjs-auth/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nextjs-auth/src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/nextjs-auth/src/app/favicon.ico -------------------------------------------------------------------------------- /nextjs-auth/src/app/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | :root { 6 | --foreground-rgb: 0, 0, 0; 7 | --background-start-rgb: 214, 219, 220; 8 | --background-end-rgb: 255, 255, 255; 9 | } 10 | 11 | @media (prefers-color-scheme: dark) { 12 | :root { 13 | --foreground-rgb: 255, 255, 255; 14 | --background-start-rgb: 0, 0, 0; 15 | --background-end-rgb: 0, 0, 0; 16 | } 17 | } 18 | 19 | body { 20 | color: rgb(var(--foreground-rgb)); 21 | } 22 | -------------------------------------------------------------------------------- /nextjs-auth/src/edgedb.ts: -------------------------------------------------------------------------------- 1 | import { createClient } from "edgedb"; 2 | import createAuth from "@edgedb/auth-nextjs/app"; 3 | 4 | export const client = createClient({ 5 | // Note: when developing locally you will need to set tls security to 6 | // insecure, because the development server uses self-signed certificates 7 | // which will cause api calls with the fetch api to fail. 8 | tlsSecurity: "insecure", 9 | }); 10 | 11 | export const auth = createAuth(client, { 12 | baseUrl: "http://localhost:3000", 13 | passwordResetPath: "/reset-password", 14 | }); 15 | -------------------------------------------------------------------------------- /nextjs-auth/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "tailwindcss"; 2 | 3 | const config: Config = { 4 | content: [ 5 | "./src/pages/**/*.{js,ts,jsx,tsx,mdx}", 6 | "./src/components/**/*.{js,ts,jsx,tsx,mdx}", 7 | "./src/app/**/*.{js,ts,jsx,tsx,mdx}", 8 | ], 9 | theme: { 10 | extend: {}, 11 | }, 12 | plugins: [], 13 | }; 14 | export default config; 15 | -------------------------------------------------------------------------------- /nextjs-blog-app-router/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /nextjs-blog-app-router/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | 38 | dbschema/edgeql-js 39 | -------------------------------------------------------------------------------- /nextjs-blog-app-router/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/nextjs-blog-app-router/app/favicon.ico -------------------------------------------------------------------------------- /nextjs-blog-app-router/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next"; 2 | import { Inter } from "next/font/google"; 3 | import "./globals.css"; 4 | 5 | const inter = Inter({ subsets: ["latin"] }); 6 | 7 | export const metadata: Metadata = { 8 | title: "Create Next App", 9 | description: "Generated by create next app", 10 | }; 11 | 12 | export default function RootLayout({ 13 | children, 14 | }: Readonly<{ 15 | children: React.ReactNode; 16 | }>) { 17 | return ( 18 | 19 | {children} 20 | 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /nextjs-blog-app-router/dbschema/default.esdl: -------------------------------------------------------------------------------- 1 | module default { 2 | type BlogPost { 3 | required title: str; 4 | required content: str { 5 | default := "" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /nextjs-blog-app-router/dbschema/migrations/00001.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1jbkm4y44e6nhehi3rzza5kfylv3ymj4iy6vx6fftwae3pj5523fq 2 | ONTO initial 3 | { 4 | CREATE TYPE default::BlogPost { 5 | CREATE REQUIRED PROPERTY content: std::str { 6 | SET default := ''; 7 | }; 8 | CREATE REQUIRED PROPERTY title: std::str; 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /nextjs-blog-app-router/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "4.5" 3 | -------------------------------------------------------------------------------- /nextjs-blog-app-router/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = {}; 3 | 4 | export default nextConfig; 5 | -------------------------------------------------------------------------------- /nextjs-blog-app-router/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nextjs-app-router", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "edgedb": "^1.4.1", 13 | "next": "14.1.0", 14 | "react": "^18", 15 | "react-dom": "^18" 16 | }, 17 | "devDependencies": { 18 | "@types/node": "^20", 19 | "@types/react": "^18", 20 | "@types/react-dom": "^18", 21 | "autoprefixer": "^10.0.1", 22 | "eslint": "^8", 23 | "eslint-config-next": "14.1.0", 24 | "postcss": "^8", 25 | "tailwindcss": "^3.3.0", 26 | "typescript": "^5" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /nextjs-blog-app-router/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /nextjs-blog-app-router/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nextjs-blog-app-router/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "tailwindcss"; 2 | 3 | const config: Config = { 4 | content: [ 5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}", 6 | "./components/**/*.{js,ts,jsx,tsx,mdx}", 7 | "./app/**/*.{js,ts,jsx,tsx,mdx}", 8 | ], 9 | theme: { 10 | extend: { 11 | backgroundImage: { 12 | "gradient-radial": "radial-gradient(var(--tw-gradient-stops))", 13 | "gradient-conic": 14 | "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))", 15 | }, 16 | }, 17 | }, 18 | plugins: [], 19 | }; 20 | export default config; 21 | -------------------------------------------------------------------------------- /nextjs-blog-app-router/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "skipLibCheck": true, 6 | "strict": true, 7 | "noEmit": true, 8 | "esModuleInterop": true, 9 | "module": "esnext", 10 | "moduleResolution": "bundler", 11 | "resolveJsonModule": true, 12 | "isolatedModules": true, 13 | "jsx": "preserve", 14 | "incremental": true, 15 | "plugins": [ 16 | { 17 | "name": "next" 18 | } 19 | ], 20 | "paths": { 21 | "@/*": ["./*"] 22 | } 23 | }, 24 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 25 | "exclude": ["node_modules"] 26 | } 27 | -------------------------------------------------------------------------------- /nextjs-blog/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /nextjs-blog/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | .pnpm-debug.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | 37 | dbschema/edgeql-js 38 | -------------------------------------------------------------------------------- /nextjs-blog/dbschema/default.esdl: -------------------------------------------------------------------------------- 1 | module default { 2 | type BlogPost { 3 | required property title -> str; 4 | required property content -> str { 5 | default := "" 6 | }; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /nextjs-blog/dbschema/migrations/00001.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1fee6oypqpjrreleos5hmivgfqg6zfkgbrowx7sw5jvnicm73hqdq 2 | ONTO initial 3 | { 4 | CREATE TYPE default::BlogPost { 5 | CREATE REQUIRED PROPERTY content -> std::str { 6 | SET default := ''; 7 | }; 8 | CREATE REQUIRED PROPERTY title -> std::str; 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /nextjs-blog/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "2.0" 3 | -------------------------------------------------------------------------------- /nextjs-blog/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /nextjs-blog/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | reactStrictMode: true, 4 | } 5 | 6 | module.exports = nextConfig 7 | -------------------------------------------------------------------------------- /nextjs-blog/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import '../styles/globals.css' 2 | import type { AppProps } from 'next/app' 3 | 4 | function MyApp({ Component, pageProps }: AppProps) { 5 | return 6 | } 7 | 8 | export default MyApp 9 | -------------------------------------------------------------------------------- /nextjs-blog/pages/api/post.ts: -------------------------------------------------------------------------------- 1 | import type {NextApiRequest, NextApiResponse} from 'next'; 2 | import {createClient} from 'edgedb'; 3 | import e, {$infer} from '../../dbschema/edgeql-js'; 4 | 5 | export const client = createClient(); 6 | 7 | const getPosts = e.select(e.BlogPost, () => ({ 8 | id: true, 9 | title: true, 10 | content: true, 11 | })); 12 | 13 | export type GetPosts = $infer; 14 | 15 | export default async function handler( 16 | req: NextApiRequest, 17 | res: NextApiResponse 18 | ) { 19 | const posts = await getPosts.run(client); 20 | res.status(200).json(posts); 21 | } 22 | -------------------------------------------------------------------------------- /nextjs-blog/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/nextjs-blog/public/favicon.ico -------------------------------------------------------------------------------- /nextjs-blog/seed.ts: -------------------------------------------------------------------------------- 1 | import {createClient} from 'edgedb'; 2 | 3 | const client = createClient(); 4 | 5 | async function run() { 6 | await client.execute(` 7 | insert BlogPost { 8 | title := "This one weird trick makes using databases fun", 9 | content := "Use EdgeDB" 10 | };`); 11 | 12 | await client.execute(` 13 | insert BlogPost { 14 | title := "How to build a blog with EdgeDB and Next.js", 15 | content := "Let's start by scaffolding our app..." 16 | };`); 17 | 18 | console.log('Seeding complete.'); 19 | } 20 | 21 | run(); 22 | -------------------------------------------------------------------------------- /nextjs-blog/styles/globals.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | padding: 0; 4 | margin: 0; 5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 7 | } 8 | 9 | a { 10 | color: inherit; 11 | text-decoration: none; 12 | } 13 | 14 | * { 15 | box-sizing: border-box; 16 | } 17 | -------------------------------------------------------------------------------- /nextjs-todo/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env.local 29 | .env.development.local 30 | .env.test.local 31 | .env.production.local 32 | 33 | # vercel 34 | .vercel 35 | 36 | *.db 37 | -------------------------------------------------------------------------------- /nextjs-todo/client.ts: -------------------------------------------------------------------------------- 1 | import {createClient} from 'edgedb'; 2 | 3 | export const client = createClient(); 4 | -------------------------------------------------------------------------------- /nextjs-todo/dbschema/default.esdl: -------------------------------------------------------------------------------- 1 | module default { 2 | type Task { 3 | required text: str; 4 | required completed: bool { 5 | default := false; 6 | }; 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /nextjs-todo/dbschema/migrations/00001.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m146naaaow4uwgbxpnjq5hyizixicxvg2ccpta24pxebzfn7xeppna 2 | ONTO initial 3 | { 4 | CREATE EXTENSION edgeql_http VERSION '1.0'; 5 | CREATE EXTENSION graphql VERSION '1.0'; 6 | CREATE TYPE default::Task { 7 | CREATE REQUIRED PROPERTY completed -> std::bool { 8 | SET default := false; 9 | }; 10 | CREATE REQUIRED PROPERTY text -> std::str; 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /nextjs-todo/dbschema/migrations/cd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/nextjs-todo/dbschema/migrations/cd -------------------------------------------------------------------------------- /nextjs-todo/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "2.0" 3 | -------------------------------------------------------------------------------- /nextjs-todo/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /nextjs-todo/next.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | async redirects() { 3 | return [ 4 | { 5 | source: '/', 6 | destination: '/all', 7 | permanent: false, 8 | }, 9 | ] 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /nextjs-todo/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import {QueryClient, QueryClientProvider} from '@tanstack/react-query'; 2 | import type {AppProps /*, AppContext */} from 'next/app'; 3 | import {useState} from 'react'; 4 | 5 | function MyApp({Component, pageProps}: AppProps) { 6 | const [queryClient] = useState(() => new QueryClient()); 7 | return ( 8 | 9 | 10 | 11 | ); 12 | } 13 | export default MyApp; 14 | -------------------------------------------------------------------------------- /nextjs-todo/pages/api/todo/clearCompleted.ts: -------------------------------------------------------------------------------- 1 | import {NextApiRequest, NextApiResponse} from 'next'; 2 | 3 | import {client} from '../../../client'; 4 | 5 | const handler = async (req: NextApiRequest, res: NextApiResponse) => { 6 | // POST /api/todo/clearCompleted 7 | if (req.method === 'POST') { 8 | await client.queryJSON(`delete Task filter .completed = true;`); 9 | return res.status(200).send('Success'); 10 | } 11 | 12 | return res.status(400); 13 | }; 14 | 15 | export default handler; 16 | -------------------------------------------------------------------------------- /nextjs-todo/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/nextjs-todo/public/favicon.ico -------------------------------------------------------------------------------- /nextjs-todo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "strict": true, 12 | "forceConsistentCasingInFileNames": true, 13 | "noEmit": true, 14 | "esModuleInterop": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "jsx": "preserve", 20 | "incremental": true 21 | }, 22 | "include": [ 23 | "next-env.d.ts", 24 | "**/*.ts", 25 | "**/*.tsx" 26 | ], 27 | "exclude": [ 28 | "node_modules" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /phoenix-github-oauth/.formatter.exs: -------------------------------------------------------------------------------- 1 | [ 2 | import_deps: [:ecto, :phoenix], 3 | inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"] 4 | ] 5 | -------------------------------------------------------------------------------- /phoenix-github-oauth/README.md: -------------------------------------------------------------------------------- 1 | # GitHubOAuth - A GitHub OAuth application on Phoenix and EdgeDB 2 | 3 | Reach the [online tutorial](https://www.edgedb.com/docs/guides/tutorials/phoenix_github_oauth) for this application! 4 | -------------------------------------------------------------------------------- /phoenix-github-oauth/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "2.0" 3 | -------------------------------------------------------------------------------- /phoenix-github-oauth/lib/github_oauth.ex: -------------------------------------------------------------------------------- 1 | defmodule GitHubOAuth do 2 | @moduledoc """ 3 | GitHubOAuth keeps the contexts that define your domain 4 | and business logic. 5 | Contexts are also responsible for managing your data, regardless 6 | if it comes from the database, an external API or others. 7 | """ 8 | 9 | def config([main_key | rest] = keyspace) when is_list(keyspace) do 10 | main = Application.fetch_env!(:github_oauth, main_key) 11 | 12 | Enum.reduce(rest, main, fn next_key, current -> 13 | case Keyword.fetch(current, next_key) do 14 | {:ok, val} -> val 15 | :error -> raise ArgumentError, "no config found under #{inspect(keyspace)}" 16 | end 17 | end) 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /phoenix-github-oauth/lib/github_oauth/edgedb.ex: -------------------------------------------------------------------------------- 1 | defmodule GitHubOAuth.EdgeDB do 2 | use EdgeDBEcto, 3 | name: __MODULE__, 4 | queries: true, 5 | otp_app: :github_oauth 6 | 7 | def child_spec(_opts \\ []) do 8 | %{ 9 | id: __MODULE__, 10 | start: {EdgeDB, :start_link, [[name: __MODULE__]]} 11 | } 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /phoenix-github-oauth/lib/github_oauth_web/controllers/user_controller.ex: -------------------------------------------------------------------------------- 1 | defmodule GitHubOAuthWeb.UserController do 2 | use GitHubOAuthWeb, :controller 3 | 4 | alias GitHubOAuth.Accounts 5 | 6 | plug :fetch_current_user 7 | 8 | def index(conn, _params) do 9 | if conn.assigns.current_user do 10 | json(conn, %{name: conn.assigns.current_user.name}) 11 | else 12 | redirect(conn, external: GitHubOAuth.GitHub.authorize_url()) 13 | end 14 | end 15 | 16 | defp fetch_current_user(conn, _opts) do 17 | user_id = get_session(conn, :user_id) 18 | user = user_id && Accounts.get_user(user_id) 19 | assign(conn, :current_user, user) 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /phoenix-github-oauth/lib/github_oauth_web/router.ex: -------------------------------------------------------------------------------- 1 | defmodule GitHubOAuthWeb.Router do 2 | use GitHubOAuthWeb, :router 3 | 4 | pipeline :api do 5 | plug :accepts, ["json"] 6 | plug :fetch_session 7 | end 8 | 9 | scope "/", GitHubOAuthWeb do 10 | pipe_through :api 11 | 12 | get "/", UserController, :index 13 | get "/oauth/callbacks/:provider", OAuthCallbackController, :new 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /phoenix-github-oauth/lib/github_oauth_web/views/error_helpers.ex: -------------------------------------------------------------------------------- 1 | defmodule GitHubOAuthWeb.ErrorHelpers do 2 | @moduledoc """ 3 | Conveniences for translating and building error messages. 4 | """ 5 | 6 | @doc """ 7 | Translates an error message. 8 | """ 9 | def translate_error({msg, opts}) do 10 | # Because the error messages we show in our forms and APIs 11 | # are defined inside Ecto, we need to translate them dynamically. 12 | Enum.reduce(opts, msg, fn {key, value}, acc -> 13 | String.replace(acc, "%{#{key}}", fn _ -> to_string(value) end) 14 | end) 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /phoenix-github-oauth/lib/github_oauth_web/views/error_view.ex: -------------------------------------------------------------------------------- 1 | defmodule GitHubOAuthWeb.ErrorView do 2 | use GitHubOAuthWeb, :view 3 | 4 | # If you want to customize a particular status code 5 | # for a certain format, you may uncomment below. 6 | # def render("500.json", _assigns) do 7 | # %{errors: %{detail: "Internal Server Error"}} 8 | # end 9 | 10 | # By default, Phoenix returns the status message from 11 | # the template name. For example, "404.json" becomes 12 | # "Not Found". 13 | def template_not_found(template, _assigns) do 14 | %{errors: %{detail: Phoenix.Controller.status_message_from_template(template)}} 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /phoenix-github-oauth/priv/edgeql/accounts/get_identity_for_user.edgeql: -------------------------------------------------------------------------------- 1 | # edgedb = :query_required_single! 2 | # mapper = GitHubOAuth.Accounts.Identity 3 | 4 | select Identity { 5 | provider, 6 | provider_token, 7 | provider_login, 8 | provider_email, 9 | provider_id, 10 | provider_meta, 11 | inserted_at, 12 | updated_at 13 | } 14 | filter 15 | .user.id = $user_id 16 | and 17 | .provider = $provider 18 | -------------------------------------------------------------------------------- /phoenix-github-oauth/priv/edgeql/accounts/get_user_by_id.edgeql: -------------------------------------------------------------------------------- 1 | # edgedb = :query_single! 2 | # mapper = GitHubOAuth.Accounts.User 3 | 4 | select User { 5 | id, 6 | name, 7 | username, 8 | email, 9 | avatar_url, 10 | external_homepage_url, 11 | inserted_at, 12 | updated_at, 13 | } 14 | filter .id = $id 15 | -------------------------------------------------------------------------------- /phoenix-github-oauth/priv/edgeql/accounts/get_user_by_provider.edgeql: -------------------------------------------------------------------------------- 1 | # edgedb = :query_single! 2 | # mapper = GitHubOAuth.Accounts.User 3 | 4 | select User { 5 | id, 6 | name, 7 | username, 8 | email, 9 | avatar_url, 10 | external_homepage_url, 11 | inserted_at, 12 | updated_at, 13 | } 14 | filter 15 | .$provider 16 | and 17 | str_lower(.email) = str_lower($email) 18 | limit 1 19 | -------------------------------------------------------------------------------- /phoenix-github-oauth/priv/edgeql/accounts/update_identity_token.edgeql: -------------------------------------------------------------------------------- 1 | # edgedb = :query_required_single 2 | 3 | with params := $params 4 | update Identity 5 | filter .id = params["id"] 6 | set { 7 | provider_token := json_get(params, "provider_token") ?? .provider_token, 8 | updated_at := cal::to_local_datetime(datetime_current(), 'UTC'), 9 | } 10 | -------------------------------------------------------------------------------- /phoenix-github-oauth/test/github_oauth_web/views/error_view_test.exs: -------------------------------------------------------------------------------- 1 | defmodule GitHubOAuthWeb.ErrorViewTest do 2 | use GitHubOAuthWeb.ConnCase, async: true 3 | 4 | # Bring render/3 and render_to_string/3 for testing custom views 5 | import Phoenix.View 6 | 7 | test "renders 404.json" do 8 | assert render(GitHubOAuthWeb.ErrorView, "404.json", []) == %{errors: %{detail: "Not Found"}} 9 | end 10 | 11 | test "renders 500.json" do 12 | assert render(GitHubOAuthWeb.ErrorView, "500.json", []) == 13 | %{errors: %{detail: "Internal Server Error"}} 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /phoenix-github-oauth/test/test_helper.exs: -------------------------------------------------------------------------------- 1 | ExUnit.start() 2 | -------------------------------------------------------------------------------- /remix-auth/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | /** @type {import('eslint').Linter.Config} */ 2 | module.exports = { 3 | extends: ["@remix-run/eslint-config", "@remix-run/eslint-config/node"], 4 | }; 5 | -------------------------------------------------------------------------------- /remix-auth/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | 3 | /.cache 4 | /build 5 | /public/build 6 | .env -------------------------------------------------------------------------------- /remix-auth/app/components/auth/SubmitButton.tsx: -------------------------------------------------------------------------------- 1 | export default function SubmitButton({ label }: { label: string }) { 2 | return ( 3 | 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /remix-auth/app/entry.client.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * By default, Remix will handle hydrating your app on the client for you. 3 | * You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨ 4 | * For more information, see https://remix.run/file-conventions/entry.client 5 | */ 6 | 7 | import { RemixBrowser } from "@remix-run/react"; 8 | import { startTransition, StrictMode } from "react"; 9 | import { hydrateRoot } from "react-dom/client"; 10 | 11 | startTransition(() => { 12 | hydrateRoot( 13 | document, 14 | 15 | 16 | 17 | ); 18 | }); 19 | -------------------------------------------------------------------------------- /remix-auth/app/routes/signout.tsx: -------------------------------------------------------------------------------- 1 | import type { ActionFunction } from "@remix-run/node"; 2 | import { redirect } from "@remix-run/node"; 3 | import auth from "~/services/auth.server"; 4 | 5 | export const action: ActionFunction = () => auth.signout(() => redirect("/")); 6 | -------------------------------------------------------------------------------- /remix-auth/app/services/auth.server.ts: -------------------------------------------------------------------------------- 1 | import createServerAuth from "@edgedb/auth-remix/server"; 2 | import { createClient } from "edgedb"; 3 | import { options } from "./auth"; 4 | 5 | export const client = createClient({ 6 | //Note: when developing locally you will need to set tls security to insecure, because the dev server uses self-signed certificates which will cause api calls with the fetch api to fail. 7 | tlsSecurity: "insecure", 8 | }); 9 | 10 | const auth = createServerAuth(client, options); 11 | 12 | export default auth; 13 | -------------------------------------------------------------------------------- /remix-auth/app/services/auth.ts: -------------------------------------------------------------------------------- 1 | import createClientAuth, { 2 | type RemixAuthOptions, 3 | } from "@edgedb/auth-remix/client"; 4 | 5 | export const options: RemixAuthOptions = { 6 | baseUrl: "http://localhost:3000", 7 | passwordResetPath: "/reset-password", 8 | }; 9 | 10 | const auth = createClientAuth(options); 11 | 12 | export default auth; 13 | -------------------------------------------------------------------------------- /remix-auth/app/tailwind.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /remix-auth/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "4.2" 3 | -------------------------------------------------------------------------------- /remix-auth/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/remix-auth/public/favicon.ico -------------------------------------------------------------------------------- /remix-auth/remix.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('@remix-run/dev').AppConfig} */ 2 | export default { 3 | ignoredRouteFiles: ["**/.*"], 4 | // appDirectory: "app", 5 | // assetsBuildDirectory: "public/build", 6 | // publicPath: "/build/", 7 | // serverBuildPath: "build/index.js", 8 | }; 9 | -------------------------------------------------------------------------------- /remix-auth/remix.env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /remix-auth/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "tailwindcss"; 2 | 3 | export default { 4 | content: ["./app/**/*.{js,jsx,ts,tsx}"], 5 | theme: { 6 | extend: {}, 7 | }, 8 | plugins: [], 9 | } satisfies Config; 10 | -------------------------------------------------------------------------------- /remix-auth/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"], 3 | "compilerOptions": { 4 | "lib": ["DOM", "DOM.Iterable", "ES2022"], 5 | "isolatedModules": true, 6 | "esModuleInterop": true, 7 | "jsx": "react-jsx", 8 | "moduleResolution": "Bundler", 9 | "resolveJsonModule": true, 10 | "target": "ES2022", 11 | "strict": true, 12 | "allowJs": true, 13 | "forceConsistentCasingInFileNames": true, 14 | "baseUrl": ".", 15 | "paths": { 16 | "~/*": ["./app/*"] 17 | }, 18 | 19 | // Remix takes care of building everything in `remix build`. 20 | "noEmit": true 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /remix/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /remix/.env.example: -------------------------------------------------------------------------------- 1 | SESSION_SECRET="remixrulz" 2 | -------------------------------------------------------------------------------- /remix/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ["@remix-run/eslint-config", "@remix-run/eslint-config/node"], 3 | }; 4 | -------------------------------------------------------------------------------- /remix/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | /.cache 4 | /build 5 | /public/build 6 | .env 7 | 8 | dbschema/edgeql-js 9 | -------------------------------------------------------------------------------- /remix/.prettierrc: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /remix/app/entry.client.tsx: -------------------------------------------------------------------------------- 1 | import ReactDOM from "react-dom"; 2 | import { RemixBrowser } from "@remix-run/react"; 3 | 4 | ReactDOM.hydrate(, document); 5 | -------------------------------------------------------------------------------- /remix/app/entry.server.tsx: -------------------------------------------------------------------------------- 1 | import type { EntryContext } from "@remix-run/node"; 2 | import { RemixServer } from "@remix-run/react"; 3 | import { renderToString } from "react-dom/server"; 4 | 5 | export default function handleRequest( 6 | request: Request, 7 | responseStatusCode: number, 8 | responseHeaders: Headers, 9 | remixContext: EntryContext 10 | ) { 11 | const markup = renderToString( 12 | 13 | ); 14 | 15 | responseHeaders.set("Content-Type", "text/html"); 16 | 17 | return new Response("" + markup, { 18 | status: responseStatusCode, 19 | headers: responseHeaders, 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /remix/app/routes/logout.tsx: -------------------------------------------------------------------------------- 1 | import type { ActionFunction, LoaderFunction } from "@remix-run/node"; 2 | import { redirect } from "@remix-run/node"; 3 | 4 | import { logout } from "~/utils/session.server"; 5 | 6 | export const action: ActionFunction = async ({ request }) => { 7 | return logout(request); 8 | }; 9 | 10 | export const loader: LoaderFunction = async () => { 11 | return redirect("/"); 12 | }; 13 | -------------------------------------------------------------------------------- /remix/app/styles/global-large.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | font-size: 3.75rem; 3 | line-height: 1; 4 | } 5 | 6 | h2 { 7 | font-size: 1.875rem; 8 | line-height: 2.25rem; 9 | } 10 | 11 | h3 { 12 | font-size: 1.5rem; 13 | line-height: 2rem; 14 | } 15 | 16 | h4 { 17 | font-size: 1.25rem; 18 | line-height: 1.75rem; 19 | } 20 | 21 | h5 { 22 | font-size: 1.125rem; 23 | line-height: 1.75rem; 24 | } 25 | -------------------------------------------------------------------------------- /remix/app/styles/global-medium.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | font-size: 3rem; 3 | line-height: 1; 4 | } 5 | 6 | h2 { 7 | font-size: 2.25rem; 8 | line-height: 2.5rem; 9 | } 10 | 11 | h3 { 12 | font-size: 1.25rem; 13 | line-height: 1.75rem; 14 | } 15 | 16 | h4 { 17 | font-size: 1.125rem; 18 | line-height: 1.75rem; 19 | } 20 | 21 | h5, 22 | h6 { 23 | font-size: 1rem; 24 | line-height: 1.5rem; 25 | } 26 | 27 | .container { 28 | --gutter: 40px; 29 | } 30 | -------------------------------------------------------------------------------- /remix/app/utils/db.server.ts: -------------------------------------------------------------------------------- 1 | import {createClient} from "edgedb"; 2 | export const client = createClient(); -------------------------------------------------------------------------------- /remix/dbschema/default.esdl: -------------------------------------------------------------------------------- 1 | module default { 2 | 3 | type User { 4 | required property createdAt -> datetime { 5 | default := datetime_current(); 6 | } 7 | required property username -> str { constraint exclusive; }; 8 | required property passwordHash -> str; 9 | multi link jokes := . User { 14 | on target delete delete source; 15 | } 16 | required property createdAt -> datetime { 17 | default := datetime_current(); 18 | } 19 | required property name -> str; 20 | required property content -> str; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /remix/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "2.0" 3 | -------------------------------------------------------------------------------- /remix/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/remix/public/favicon.ico -------------------------------------------------------------------------------- /remix/public/fonts/baloo/baloo.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/remix/public/fonts/baloo/baloo.woff -------------------------------------------------------------------------------- /remix/public/social.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/remix/public/social.png -------------------------------------------------------------------------------- /remix/remix.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @type {import('@remix-run/dev').AppConfig} 3 | */ 4 | module.exports = { 5 | ignoredRouteFiles: ["**/.*"], 6 | // appDirectory: "app", 7 | // assetsBuildDirectory: "public/build", 8 | // serverBuildPath: "build/index.js", 9 | // publicPath: "/build/", 10 | }; 11 | -------------------------------------------------------------------------------- /remix/remix.env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /remix/sandbox.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "hardReloadOnChange": true, 3 | "container": { 4 | "port": 3000 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /remix/start_with_migrations.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -ex 4 | npm run start 5 | -------------------------------------------------------------------------------- /remix/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"], 3 | "compilerOptions": { 4 | "lib": ["DOM", "DOM.Iterable", "ES2019"], 5 | "isolatedModules": true, 6 | "esModuleInterop": true, 7 | "jsx": "react-jsx", 8 | "moduleResolution": "node", 9 | "resolveJsonModule": true, 10 | "target": "ES2019", 11 | "strict": true, 12 | "allowJs": true, 13 | "forceConsistentCasingInFileNames": true, 14 | "baseUrl": ".", 15 | "paths": { 16 | "~/*": ["./app/*"] 17 | }, 18 | 19 | // Remix takes care of building everything in `remix build`. 20 | "noEmit": true 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /strawberry-gql/.editorconfig: -------------------------------------------------------------------------------- 1 | # https://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | indent_style = space 7 | indent_size = 2 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | charset = utf-8 11 | end_of_line = lf 12 | 13 | [*.{py,md}] 14 | indent_size = 4 15 | 16 | [Makefile] 17 | indent_size = 4 18 | indent_style = tab 19 | -------------------------------------------------------------------------------- /strawberry-gql/.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | extend-exclude = 3 | .git, 4 | __pycache__, 5 | docs/source/conf.py, 6 | old, 7 | build, 8 | dist, 9 | .venv, 10 | venv 11 | 12 | extend-ignore = E203, E266, E501, W605 13 | 14 | # Black's default line length. 15 | max-line-length = 88 16 | 17 | max-complexity = 18 18 | 19 | # Specify the list of error codes you wish Flake8 to report. 20 | select = B,C,E,F,W,T4,B9 21 | 22 | # Parallelism 23 | jobs = 4 24 | -------------------------------------------------------------------------------- /strawberry-gql/.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # See https://pre-commit.com for more information 2 | # See https://pre-commit.com/hooks.html for more hooks 3 | repos: 4 | - repo: https://github.com/pre-commit/pre-commit-hooks 5 | rev: v4.0.1 6 | hooks: 7 | - id: trailing-whitespace 8 | - id: end-of-file-fixer 9 | - id: check-yaml 10 | - id: check-added-large-files 11 | 12 | - repo: local 13 | hooks: 14 | - id: lint 15 | name: Run Black Isort Mypy Flake8 16 | entry: make lint 17 | language: system 18 | types: [python] 19 | -------------------------------------------------------------------------------- /strawberry-gql/README.md: -------------------------------------------------------------------------------- 1 | ## Strawberry graphQL 2 | 3 | Read the tutorial [here](). 4 | -------------------------------------------------------------------------------- /strawberry-gql/app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/strawberry-gql/app/__init__.py -------------------------------------------------------------------------------- /strawberry-gql/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "2.0" 3 | -------------------------------------------------------------------------------- /strawberry-gql/requirements-dev.in: -------------------------------------------------------------------------------- 1 | # For linting. 2 | black 3 | flake8 4 | isort 5 | mypy 6 | 7 | # For dep management. 8 | pip-tools 9 | 10 | -------------------------------------------------------------------------------- /strawberry-gql/requirements.in: -------------------------------------------------------------------------------- 1 | edgedb 2 | fastapi 3 | httpx[cli] 4 | strawberry-graphql 5 | uvicorn[standard] 6 | -------------------------------------------------------------------------------- /strawberry-gql/scripts/health_check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # Run the uvicorn server in the background. 6 | 7 | nohup uvicorn app.main:app --port 5000 --reload >> /dev/null & 8 | 9 | # Give the server enough time to be ready before accepting requests. 10 | sleep 2 11 | 12 | # Run the healthcheck. 13 | if [[ $(httpx -m GET http://localhost:5000/health_check 2>&1) =~ "200 OK" ]]; then 14 | echo "Health check passed!" 15 | exit 0 16 | else 17 | echo "Health check failed!" 18 | exit 1 19 | fi 20 | 21 | # Cleanup. 22 | pkill -9 -ecfi python 23 | -------------------------------------------------------------------------------- /sveltekit-auth/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | .vercel 10 | .output 11 | vite.config.js.timestamp-* 12 | vite.config.ts.timestamp-* 13 | .yarn 14 | /.yarn -------------------------------------------------------------------------------- /sveltekit-auth/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /sveltekit-auth/.yarnrc.yml: -------------------------------------------------------------------------------- 1 | nodeLinker: node-modules 2 | -------------------------------------------------------------------------------- /sveltekit-auth/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "4.4" 3 | -------------------------------------------------------------------------------- /sveltekit-auth/postcss.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /sveltekit-auth/src/app.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /sveltekit-auth/src/app.d.ts: -------------------------------------------------------------------------------- 1 | // See https://kit.svelte.dev/docs/types#app 2 | // for information about these interfaces 3 | 4 | import type { ServerRequestAuth } from "@edgedb/auth-sveltekit/server"; 5 | 6 | declare global { 7 | namespace App { 8 | // interface Error {} 9 | interface Locals { 10 | auth: ServerRequestAuth; 11 | } 12 | // interface PageData {} 13 | // interface PageState {} 14 | // interface Platform {} 15 | } 16 | } 17 | 18 | export {}; 19 | -------------------------------------------------------------------------------- /sveltekit-auth/src/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %sveltekit.head% 8 | 9 | 10 |
%sveltekit.body%
11 | 12 | 13 | -------------------------------------------------------------------------------- /sveltekit-auth/src/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %sveltekit.error.message% 6 | 7 | 8 |

An error occurred.

9 |

Status: %sveltekit.status%

10 |

Message: %sveltekit.error.message%

11 | 12 | 13 | -------------------------------------------------------------------------------- /sveltekit-auth/src/lib/auth.ts: -------------------------------------------------------------------------------- 1 | import createClientAuth, { 2 | type AuthOptions, 3 | } from "@edgedb/auth-sveltekit/client"; 4 | 5 | export const options: AuthOptions = { 6 | baseUrl: "http://localhost:5173", 7 | passwordResetPath: "/reset-password", 8 | }; 9 | 10 | const auth = createClientAuth(options); 11 | 12 | export default auth; 13 | -------------------------------------------------------------------------------- /sveltekit-auth/src/lib/components/auth/SubmitButton.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 | 11 | -------------------------------------------------------------------------------- /sveltekit-auth/src/lib/components/todos/types.ts: -------------------------------------------------------------------------------- 1 | export interface Todo { 2 | id: string; 3 | content: string; 4 | completed: boolean; 5 | created_on: string; 6 | } 7 | -------------------------------------------------------------------------------- /sveltekit-auth/src/lib/server/auth.ts: -------------------------------------------------------------------------------- 1 | import { createClient } from "edgedb"; 2 | 3 | export const client = createClient({ 4 | //Note: when developing locally you will need to set tls security to insecure, because the dev server uses self-signed certificates which will cause api calls with the fetch api to fail. 5 | tlsSecurity: "insecure", 6 | }); 7 | -------------------------------------------------------------------------------- /sveltekit-auth/src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | export function transformSearchParams(searchParams: URLSearchParams): { 2 | [key: string]: string | string[] | undefined; 3 | } { 4 | const params = {}; 5 | for (const [key, value] of searchParams.entries()) { 6 | Object.assign(params, { [key]: value }); 7 | } 8 | 9 | return params; 10 | } 11 | 12 | export function parseError(e: any) { 13 | let err: any = e instanceof Error ? e.message : String(e); 14 | 15 | try { 16 | err = JSON.parse(err); 17 | } catch {} 18 | 19 | return err?.error?.message ?? JSON.stringify(err); 20 | } 21 | -------------------------------------------------------------------------------- /sveltekit-auth/src/routes/+layout.svelte: -------------------------------------------------------------------------------- 1 | 8 | 9 |
10 |
11 | {#if !isHomepage} 12 | 13 | 14 | Home 15 | 16 | {/if} 17 | 18 | 19 |
20 |
21 | -------------------------------------------------------------------------------- /sveltekit-auth/src/routes/signin/+page.server.ts: -------------------------------------------------------------------------------- 1 | import { fail, redirect } from "@sveltejs/kit"; 2 | import { parseError } from "$lib/utils"; 3 | import type { Actions } from "./$types"; 4 | 5 | export const load = async ({ locals }) => ({ 6 | providers: await locals.auth.getProvidersInfo(), 7 | }); 8 | 9 | export const actions = { 10 | default: async ({ request, locals }) => { 11 | try { 12 | const formData = await request.formData(); 13 | await locals.auth.emailPasswordSignIn(formData); 14 | } catch (e) { 15 | return fail(400, { 16 | error: `Error signing up: ${parseError(e)}`, 17 | }); 18 | } 19 | 20 | redirect(303, "/"); 21 | }, 22 | } satisfies Actions; 23 | -------------------------------------------------------------------------------- /sveltekit-auth/src/routes/signout/+page.server.ts: -------------------------------------------------------------------------------- 1 | import { redirect } from "@sveltejs/kit"; 2 | import type { Actions } from "./$types"; 3 | 4 | export const actions = { 5 | default: async ({ locals }) => { 6 | await locals.auth.signout(); 7 | redirect(303, "/"); 8 | }, 9 | } satisfies Actions; 10 | -------------------------------------------------------------------------------- /sveltekit-auth/static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/sveltekit-auth/static/favicon.png -------------------------------------------------------------------------------- /sveltekit-auth/static/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /sveltekit-auth/tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | export default { 3 | content: ["./src/**/*.{html,js,svelte,ts}"], 4 | theme: { 5 | extend: {}, 6 | }, 7 | plugins: [], 8 | }; 9 | -------------------------------------------------------------------------------- /sveltekit-auth/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./.svelte-kit/tsconfig.json", 3 | "compilerOptions": { 4 | "allowJs": true, 5 | "checkJs": true, 6 | "esModuleInterop": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "resolveJsonModule": true, 9 | "skipLibCheck": true, 10 | "sourceMap": true, 11 | "strict": true, 12 | "moduleResolution": "bundler" 13 | } 14 | // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias 15 | // 16 | // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes 17 | // from the referenced tsconfig.json - TypeScript does not merge them in 18 | } 19 | -------------------------------------------------------------------------------- /sveltekit-auth/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { sveltekit } from '@sveltejs/kit/vite'; 2 | import { defineConfig } from 'vite'; 3 | 4 | export default defineConfig({ 5 | plugins: [sveltekit()] 6 | }); 7 | -------------------------------------------------------------------------------- /sveltekit/.eslintignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | 10 | # Ignore files for PNPM, NPM and YARN 11 | pnpm-lock.yaml 12 | package-lock.json 13 | yarn.lock 14 | -------------------------------------------------------------------------------- /sveltekit/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: '@typescript-eslint/parser', 4 | extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], 5 | plugins: ['svelte3', '@typescript-eslint'], 6 | ignorePatterns: ['*.cjs'], 7 | overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }], 8 | settings: { 9 | 'svelte3/typescript': () => require('typescript') 10 | }, 11 | parserOptions: { 12 | sourceType: 'module', 13 | ecmaVersion: 2020 14 | }, 15 | env: { 16 | browser: true, 17 | es2017: true, 18 | node: true 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /sveltekit/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | .vercel 10 | .output 11 | dbschema/edgeql-js 12 | -------------------------------------------------------------------------------- /sveltekit/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /sveltekit/.nvmrc: -------------------------------------------------------------------------------- 1 | lts/gallium -------------------------------------------------------------------------------- /sveltekit/.prettierignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | 10 | # Ignore files for PNPM, NPM and YARN 11 | pnpm-lock.yaml 12 | package-lock.json 13 | yarn.lock 14 | -------------------------------------------------------------------------------- /sveltekit/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "useTabs": true, 3 | "singleQuote": true, 4 | "trailingComma": "none", 5 | "printWidth": 100 6 | } 7 | -------------------------------------------------------------------------------- /sveltekit/dbschema/default.esdl: -------------------------------------------------------------------------------- 1 | module default { 2 | type Todo { 3 | required property created_at -> datetime { 4 | default := datetime_current(); 5 | }; 6 | required property created_by -> uuid; 7 | required property text -> str; 8 | required property done -> bool { 9 | default := false; 10 | }; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /sveltekit/dbschema/migrations/00001.edgeql: -------------------------------------------------------------------------------- 1 | CREATE MIGRATION m1m64sdjz2lvcla6w3as4cwo7orqkhj4avxw4qzfyemfoczqfpomsa 2 | ONTO initial 3 | { 4 | CREATE TYPE default::Todo { 5 | CREATE REQUIRED PROPERTY created_at -> std::datetime { 6 | SET default := (std::datetime_current()); 7 | }; 8 | CREATE REQUIRED PROPERTY created_by -> std::uuid; 9 | CREATE REQUIRED PROPERTY done -> std::bool { 10 | SET default := false; 11 | }; 12 | CREATE REQUIRED PROPERTY text -> std::str; 13 | }; 14 | }; 15 | -------------------------------------------------------------------------------- /sveltekit/edgedb.toml: -------------------------------------------------------------------------------- 1 | [edgedb] 2 | server-version = "2.0" 3 | -------------------------------------------------------------------------------- /sveltekit/playwright.config.ts: -------------------------------------------------------------------------------- 1 | import type { PlaywrightTestConfig } from '@playwright/test'; 2 | 3 | const config: PlaywrightTestConfig = { 4 | webServer: { 5 | command: 'npm run build && npm run preview', 6 | port: 4173 7 | } 8 | }; 9 | 10 | export default config; 11 | -------------------------------------------------------------------------------- /sveltekit/src/app.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | // See https://kit.svelte.dev/docs/types#app 4 | // for information about these interfaces 5 | // and what to do when importing types 6 | declare namespace App { 7 | interface Locals { 8 | userid: string; 9 | } 10 | 11 | // interface Platform {} 12 | 13 | // interface PrivateEnv {} 14 | 15 | // interface PublicEnv {} 16 | } 17 | -------------------------------------------------------------------------------- /sveltekit/src/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %sveltekit.head% 8 | 9 | 10 |
%sveltekit.body%
11 | 12 | 13 | -------------------------------------------------------------------------------- /sveltekit/src/lib/edgedb.ts: -------------------------------------------------------------------------------- 1 | import { createClient } from 'edgedb'; 2 | 3 | export const client = createClient(); 4 | -------------------------------------------------------------------------------- /sveltekit/src/routes/+page.ts: -------------------------------------------------------------------------------- 1 | export const prerender = true; 2 | -------------------------------------------------------------------------------- /sveltekit/src/routes/about/+page.ts: -------------------------------------------------------------------------------- 1 | import { browser, dev } from '$app/env'; 2 | 3 | // we don't need any JS on this page, though we'll load 4 | // it in dev so that we get hot module replacement... 5 | export const hydrate = dev; 6 | 7 | // ...but if the client-side router is already loaded 8 | // (i.e. we came here from elsewhere in the app), use it 9 | export const router = browser; 10 | 11 | // since there's no dynamic data here, we can prerender 12 | // it so that it gets served as a static asset in prod 13 | export const prerender = true; 14 | -------------------------------------------------------------------------------- /sveltekit/static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/sveltekit/static/favicon.png -------------------------------------------------------------------------------- /sveltekit/static/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /sveltekit/static/svelte-welcome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/sveltekit/static/svelte-welcome.png -------------------------------------------------------------------------------- /sveltekit/static/svelte-welcome.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geldata/gel-examples/0bb7d84ac77fb8b2c1eaef90fb5f37cb1de46099/sveltekit/static/svelte-welcome.webp -------------------------------------------------------------------------------- /sveltekit/svelte.config.js: -------------------------------------------------------------------------------- 1 | import adapter from '@sveltejs/adapter-auto'; 2 | import preprocess from 'svelte-preprocess'; 3 | 4 | /** @type {import('@sveltejs/kit').Config} */ 5 | const config = { 6 | // Consult https://github.com/sveltejs/svelte-preprocess 7 | // for more information about preprocessors 8 | preprocess: preprocess(), 9 | 10 | kit: { 11 | adapter: adapter(), 12 | 13 | alias: { 14 | $db: 'dbschema/edgeql-js' 15 | }, 16 | 17 | // Override http methods in the Todo forms 18 | methodOverride: { 19 | allowed: ['PATCH', 'DELETE'] 20 | } 21 | } 22 | }; 23 | 24 | export default config; 25 | -------------------------------------------------------------------------------- /sveltekit/tests/test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from '@playwright/test'; 2 | 3 | test('about page has expected h1', async ({ page }) => { 4 | await page.goto('/about'); 5 | expect(await page.textContent('h1')).toBe('About this app'); 6 | }); 7 | -------------------------------------------------------------------------------- /sveltekit/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./.svelte-kit/tsconfig.json", 3 | "compilerOptions": { 4 | "allowJs": true, 5 | "checkJs": true, 6 | "esModuleInterop": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "resolveJsonModule": true, 9 | "skipLibCheck": true, 10 | "sourceMap": true, 11 | "strict": true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /sveltekit/vite.config.js: -------------------------------------------------------------------------------- 1 | import { sveltekit } from '@sveltejs/kit/vite'; 2 | 3 | /** @type {import('vite').UserConfig} */ 4 | const config = { 5 | plugins: [sveltekit()] 6 | }; 7 | 8 | export default config; 9 | --------------------------------------------------------------------------------