Skip to main content

Wrapping up

Now that we have our modules ready, let's create and run our GraphQL application.

Create the application

Create an entry point for your application in src/app.ts:

import { createApplication } from "@baeta/core";
import { userModule } from "./modules/user";
import { userPhotosModule } from "./modules/user-photos";

import { createYoga } from "graphql-yoga";
import { createServer } from "node:http";

const baeta = createApplication({
modules: [userModule, userPhotosModule],
});

const yoga = createYoga({
schema: baeta.schema,
});

const server = createServer(yoga);

server.listen(4000, () => {
console.log("🚀 Server ready at http://localhost:4000/graphql");
});
note

We're using GraphQL Yoga for this example due to its simple setup, but Baeta is compatible with all GraphQL servers like Apollo Server, Express GraphQL, and others.

Start the application

Run your application with:

yarn start

Or with the full command:

yarn baeta build --watch --generate --onSuccess='node --enable-source-maps dist/app.js'

What's Next?

Now that you have a running GraphQL API, you can:

tip

Visit our examples repository for more complex implementations and real-world usage patterns.