Coder Social home page Coder Social logo

rivet-gg / opengb Goto Github PK

View Code? Open in Web Editor NEW
54.0 1.0 2.0 5.41 MB

Open Game Backend: Open-source modular backend for all games and tools. Works with Godot, Unity, Unreal Engine, and HTML5.

Home Page: https://opengb.dev

License: Apache License 2.0

TypeScript 100.00%
backend backend-as-a-service game game-backend multiplayer game-development deno postgres postgresql bevy godot html5 unity unreal-engine

opengb's Issues

Explore creating shared Prisma core runtime & WASM

We serve multiple Prisma instances, but they share the same library and WASM. Explore making them all import the same runtime to safe both (a) binary size and (b) memory usage.

This will require some finessing of the imports.

This may become essential if we get close to going over the 10 MB limit for Cloudflare Workers.

Add `dependencies` to modules to restrict what it can call

If a module calls other modules, list which dependencies it calls in the module.yaml.

Developers will only be able to call the explicit dependencies from ModuleContext (and its subclasses).

This is intended to just be a name, not a reference to a specific registry + module like NPM.

Eventually: dependencies will be able to be remapped (i.e. if I have a fork of the "users" module).

Write SQL 101 for games

  • Locking rows (inventory example)
  • Unlogged tables for real time data
  • Access logs & point in time recovery
  • Other extensions?

Document recommendations for schemas

  • Use UUIDs for indexes (and why)
  • Use camel case for keys
  • Never delete values
  • Manually altering migrations as needed to add constraints
  • Recommended types (dates, uuid, integer, floats, etc)

Fix dependency of OGSE on generated registry.d.ts

This PR includes dependencies on @ogs/helpers/registry.d.ts in the engine itself. This file is generated and cannot be referenced from within the engine. The Registry generic must be passed to the types that use it directly instead of importing it from within the engine.

#51

Figure out how to cleanly re-export Prisma namespace

We currently export prisma (which holds the types) and Prisma (which holds the utility functions).

To reference a type, you need to use primsa.Prisma.XXXXGetPayload while to use a utility function, you need to use Prisma.xxxx.

Ideally it's just Prisma for both types and utils

Add module configs

  • Get JSON Schema from config.ts
  • Validate config
  • Pass to module context
  • Pass to runtime entrypoint

Prisma leaks timeout in test

Run a test with deno test --trace-ops and disable sanitizeOps in Runtime.test to see the issue:

    at op_sleep (ext:core/00_infra.js:265:13)
    at runAfterTimeout (ext:deno_web/02_timers.js:234:20)
    at initializeTimer (ext:deno_web/02_timers.js:192:3)
    at setTimeout (ext:deno_web/02_timers.js:336:10)
    at pm (file:///Users/nathan/rivet/ogs/dist/prisma/friends/esm.js:7264:14)
    at <anonymous> (wasm://wasm/00952342:1:2131297)
    at <anonymous> (wasm://wasm/00952342:1:2153871)
    at am (file:///Users/nathan/rivet/ogs/dist/prisma/friends/esm.js:7183:9)
    at n (file:///Users/nathan/rivet/ogs/dist/prisma/friends/esm.js:7252:20)
    at new Promise (<anonymous>)

Sanitize ops is disabled until this can be fixed.

Type-safe module calling on ctx

Example: ctx.users.get({ โ€ฆ })

This should only make the listed dependencies available in the given context. If using a context that's not ModuleContext, then all modules are available. Should be easy to do using a Partial.

Any module names that conflict with the core types (e.g. db) will be renamed with an underscore. e.g. calling the db module looks like ctx._db.doSomething({})

This needs to have a type-safe req/res format. This will require generating types in the runtime_config.ts file.

Autogenerate script context type

This will include:

  • (Later) all errors for the module
  • (Later) the Drizzle schema
  • (Later) schema for all other modules in the project

Type Bindings

ctx.modules.<module_name>.<script_name>({}) should be type safe, awaitable, and not be overloaded by typescript resolve times

Research bi-directional streaming

Need to figure out how (and if) this works with OpenAPI

Need to figure out the easiest x-platform solution

Can we support multiple protocols?

Prior art:

  • Rivet uses blocking requests for server side events
  • SSE work, but have limitations on number of concurrent streams
  • WS works, but requires extra libraries that are usually finicky on non-web platforms
  • gRPC requires protobuf and has a weird handler requirement for WebSockets. Raw TCP will not play nice on edge functions & most load balancers.
  • tRPC is a joke

Migrate JSON schema -> zod

This will read the types from the parameters on the run config on the fly

Make sure to validate UUIDs

removes ajv

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

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

  • D3 photo D3

    Data-Driven Documents codes.