Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): initialise mintlify app #47

Merged
merged 7 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .changeset/khaki-games-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
"@orbitkit/auth": patch
"@orbitkit/env": patch
"@orbitkit/docs": patch
"@orbitkit/web": patch
"@orbitkit/marketing": patch
"@orbitkit/assets": patch
"eslint-config-orbitkit": patch
"@orbitkit/storybook": patch
"@orbitkit/tailwind": patch
"@orbitkit/tsconfig": patch
"@orbitkit/vite": patch
"@orbitkit/core": patch
"@orbitkit/db": patch
"@orbitkit/ui": patch
"@orbitkit/utils": patch
---

docs app and optional oauth
3 changes: 2 additions & 1 deletion .markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"first-line-h1": false,
"no-inline-html": false,
"no-space-in-emphasis": false,
"no-duplicate-heading": false
"no-duplicate-heading": false,
"code-block-style": false
}
95 changes: 95 additions & 0 deletions apps/docs/commands.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
title: Commands
icon: 'code'
description: 'A guide on the available commands in the project, what they do and how to use them.'
---

<Note>
OrbitKit uses Turborepo to run commands across apps & packages in the
monorepo, you can also use `pnpm --filter` commands to do the same without
dependant tasks running or caching.
</Note>

## `dev`

```bash
pnpm turbo dev
```

The `dev` command starts up all of the apps in the monorepo in development mode and also starts up the watch mode on the packages that need bundling.

The `dev` command also applies Drizzle ORM schema migrations to the database, it will generate any missing migrations and apply them to the database.

You can start up for example only the web application by using `pnpm turbo dev --filter=web`.

## `build`

```bash
pnpm turbo build
```

The `build` command builds all of the apps in the monorepo and also builds the packages that need bundling.

You can build for example only the web application by using `pnpm turbo build --filter=web`.

## `start`

```bash
pnpm turbo start
```

The `start` command starts up all of the apps in the monorepo in production mode. This is done after building all of the apps & packages automatically via turborepo dependant tasks, so you don't need to build before you run the start command.

## `lint`

```bash
pnpm turbo lint
```

The `lint` command runs ESLint on all of the apps & packages in the monorepo.

## `typecheck`

```bash
pnpm turbo typecheck
```

The `typecheck` command runs TypeScript type checking on all of the apps & packages in the monorepo.

## `storybook`

```bash
pnpm turbo storybook
```

The `storybook` command starts up the `ui` package storybook instance in dev mode.

## `build-storybook`

```bash
pnpm turbo build-storybook
```

The `build-storybook` command builds the `ui` package storybook application, you will find the output in a `storybook-static` in the `packages/ui` directory.

## `db:generate`

```bash
pnpm turbo db:generate
```

The `db:generate` command will generate new schema migration files when necessary (based on the typescript schema files in `packages/db/src/schema` directory).

## `db:migrate`

```bash
pnpm turbo db:migrate
```

The `db:migrate` command will apply all of the schema migrations to the database.

## Database Commands

OrbitKit supports all of [DrizzleKit's commands](https://orm.drizzle.team/kit-docs/commands) which are all configured for you in the `packages/db/package.json` file.

You can invoke these commands using `pnpm`, for example to check for collisions and inconsistencies between your database and the schema, you can run `pnpm --filter db db:check`.
14 changes: 14 additions & 0 deletions apps/docs/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions apps/docs/images/hero-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions apps/docs/images/hero-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
184 changes: 184 additions & 0 deletions apps/docs/installation.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
---
title: Installation
icon: 'bars-progress'
description: 'A guide on how to install and run OrbitKit.'
---

## Introduction

OrbitKit is setup as a monorepo, which comes with three applications and many packages, here is the codebase structure:

```bash
apps
├── docs # Documentation website with Mintlify
├── marketing # Marketing website with Astro
└── web # Web application with Next.js
packages
├── assets # Shared assets library for example, images, fonts, etc.
├── auth # Auth package to handle authentication.
└── config # Config directory hosts tools config packages.
├── eslint # ESLint config package.
├── storybook # Storybook config package.
├── tailwind # Tailwind preset package.
├── tsconfig # TSConfig presets library to configure TypeScript.
└── vite # Shared vite config.
├── core # Empty package for business logic.
├── db # Database handling package with Drizzle ORM.
├── env # Environment variables validation using t3-env.
├── ui # Shadcn UI library with Storybook.
└── utils # misc utilities.
```

We will go more in detail about every aspect of orbitkit later on, but this should give you a good idea of what to expect.

## Prerequisites

Before you begin, ensure you have met the following requirements:

- You have `Node v20` and `Pnpm v8` installed on your machine. We recommend you using [Volta](https://volta.sh) to manage your Node versions and you can use it as well for `pnpm` experimentally.

That is actually pretty much all you need!

## Installation

With all that being said, we are ready to start using Orbitkit! We firstly need to clone it down to your machine and then we can install dependencies, configure environment variables and run it!

<AccordionGroup>
<Accordion title="1. Clone the repository" icon="github">
There are three ways to get OrbitKit onto your machine, it all comes down to your choice.

1. You can use degit to download the code directly and remove the git history.
```bash
pnpm dlx degit ixahmedxi/orbitkit
```

2. You can [fork](https://github.com/ixahmedxi/orbitkit/fork) OrbitKit and then clone down your version of it.
```bash
# After forking the repository
git clone --depth 1 https://github.com/<your-username>/orbitkit.git <your-project-name>
```

3. You can clone the repository directly.
```bash
# Clone the repository
git clone --depth 1 https://github.com/ixahmedxi/orbitkit.git <your-project-name>
```

</Accordion>

<Accordion title="2. Install dependencies" icon="cube">
The next step is to install all of the required dependencies for OrbitKit, we use `pnpm` as the package manager.

```bash
# Navigate to the project directory
cd <your-project-name>

# Install dependencies
pnpm install
```

</Accordion>
</AccordionGroup>

### Configuring environment variables

You will need to set-up some environment variables in a `.env.local` file in the `apps/web` directory. We provide an example file in `apps/web/.env.example` that you can copy over and input the values.

```bash
# Copy the .env.example file into a .env.local file.
cp ./apps/web/.env.example ./apps/web/.env.local
```

Here is how you can obtain each of the required values:

#### Database

The database that OrbitKit uses is [Neon](https://neon.tech) PostgreSQL. You should create a free account and input the database url given to you on the dashboard to be the value of the `DATABASE_URL` environment variable.

Make sure that the `DATABASE_URL` ends with `?sslmode=require`.

#### Uploadthing

[Uploadthing](https://uploadthing.com) is the service of choice in OrbitKit for file uploads, you should create an account and input the api keys into the `.env.local` File.

#### Unkey (optional)

[Unkey](https://unkey.dev) is the service of choice in OrbitKit for rate limiting, it is however optional as that if the `UNKEY_ROOT_KEY` or `UNKEY_NAMESPACE` variables are not supplied, no rate limiting is applied.

To obtain this key, head over to your unkey dashboard and create a new ratelimit namespace, then in your settings, create a new root key, that will be the value of your environment variable.

As for the namespace that you have created, you will need to put that as the value of the `UNKEY_NAMESPACE` environment variable.

#### OAuth

OrbitKit currently ships with two authentication providers, Google and Github. You will need to create an OAuth application on the respective platforms and input the values into the `.env.local` file.

<Note>
Based on the environment variables set, authentication will be provided. For
example, setting `AUTH_GITHUB_ID` and `AUTH_GITHUB_SECRET` will make it so
that Github OAuth is then activated on the web application. The same is true
for Google OAuth.
</Note>

<AccordionGroup>
<Accordion title="Configuring Github OAuth" icon="github">
<ol>
<li>Go to your Github Settings.</li>
<li>Go to Developer Settings.</li>
<li>Go to OAuth Apps.</li>
<li>Click on New OAuth App.</li>
<li>
Fill in the details, the homepage url should be `http://localhost:3000`
and the authorization callback url should be
`http://localhost:3000/login/github/callback`.
</li>
<li>Click on Register Application.</li>
<li>
Copy the Client ID into the `AUTH_GITHUB_ID` environment variable.
</li>
<li>
Click on Generate a new client secret button and copy the client secret
into the `AUTH_GITHUB_SECRET` environment variable.
</li>
</ol>
</Accordion>
<Accordion title="Configuring Google OAuth" icon="google">
<ol>
<li>Go to the Google Cloud Console.</li>
<li>Create a new project.</li>
<li>Configure consent screen.</li>
<li>Create OAuth client ID.</li>
<li>
Fill in the details, add `http://localhost:3000` in the list of
Authorized JavaScript origins and
`http://localhost:3000/login/google/callback` in the list of Authorized
redirect URIs.
</li>
<li>
Copy the Client ID into the `AUTH_GOOGLE_ID` environment variable.
</li>
<li>
Copy the Client Secret into the `AUTH_GOOGLE_SECRET` environment
variable.
</li>
<li>
For the `AUTH_GOOGLE_CODE_VERIFIER` environment variable, you can put
any random string.
</li>
</ol>
</Accordion>
</AccordionGroup>

### Running the project

Now that you have set up the environment variables, you can run the project!

```bash
pnpm turbo dev
```

This command will apply the necessary database migrations and start the development tasks on all of the apps & packages.

You should be able to access the web app on `http://localhost:3000`, the marketing website on `http://localhost:4321` and the documentation website on `http://localhost:3002`.

For more info about the commands available to you, you can check out the [Commands](/commands) page.
73 changes: 73 additions & 0 deletions apps/docs/introduction.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
title: Introduction
icon: 'door-open'
description: '🚀 OrbitKit is an enterprise ready monorepo StarterKit ready to be the foundation you build your next startup or big idea upon.'
---

<img
className="block dark:hidden"
src="/images/hero-light.svg"
alt="Hero Light"
/>
<img
className="hidden dark:block"
src="/images/hero-dark.svg"
alt="Hero Dark"
/>

**OrbitKit** is not like any starterkit, it's built for **startups** & **big projects** alike, leveraging the newest technologies in a **monorepo codebase** to deliver a starterkit that scales with your business **from the start**.

## Features

- [**Monorepo**](https://monorepo.tools/): OrbitKit is a monorepo, giving you the ability to scale your project with ease.
- [**TypeScript**](https://www.typescriptlang.org/): type-safety is a core principle of OrbitKit.
- [**Astrojs**](https://astro.build): for a clean slate to build your marketing website on top.
- [**Next.js**](https://nextjs.org): Web application is included, giving you a solid foundation for your product.
- [**Turborepo**](https://turbo.build/repo): caching builds so you never have to run the same command twice.
- [**Drizzle ORM**](https://orm.drizzle.team): providing a fully type-safe way to interact with your database.
- [**Neon DB**](https://neon.tech): serverless database, with autoscaling, branching, and bottomless storage.
- [**Uploadthing**](https://uploadthing.com/): for an easy, type-safe way of handling file uploads.
- [**Unkey**](https://unkey.dev): for a fast way of rate-limiting the web app.
- [**Lucia auth**](https://lucia-auth.com): for authentication, giving you full flexibility and control over your user system.
- [**Tailwind CSS**](https://tailwindcss.com): for styling, with [**Radix UI Colors**](https://www.radix-ui.com/colors) for automatic light/dark mode handling.
- [**Shadcn UI**](https://ui.shadcn.com): full implementation in a dedicated package.
- [**Storybook**](https://storybook.js.org): to develop, test and visualize your components in isolation.
- [**Github Actions**](https://github.com/features/actions): for CI/CD, with automatic DB branching & code checks.
- [**next-themes**](https://github.com/pacocoursey/next-themes): for easy light/dark mode handling in the web app.
- [**Changesets**](https://github.com/changesets/changesets): for managing versioning and changelogs.
- [**tsup**](https://github.com/egoist/tsup): for fast, easy to configure bundling of packages.
- [**ts-reset**](https://github.com/total-typescript/ts-reset): for the apps, improving the types for common JavaScript APIs.
- [**ESLint**](https://eslint.org/), [**Prettier**](https://prettier.io), [**Markdownlint**](https://github.com/DavidAnson/markdownlint), [**Cspell**](https://cspell.org), [**Husky**](https://github.com/typicode/husky), [**Lint-staged**](https://github.com/lint-staged/lint-staged) and [**Commitlint**](https://github.com/conventional-changelog/commitlint) for code quality.
- **ESM Only**: because CJS should be left in the past.

And so much more!

## Motivation

OrbitKit was born out of the need for a new type of starterkits, ones that are "headless" and are more scalable meaning, no UI templates, no pre-built landing page, just the core primitives, services and tools you need configured together.

On top of that, it's a monorepo, because sooner or later you will transition to a monorepo (god forbid you pick multi-repo) so why not start with one from the beginning?

## What you get

On the surface, it's pretty easy to see what you get with OrbitKit, but let's break it down:

1. Next.js product web application
2. Astrojs marketing website
3. Mintlify docs website

These are the three core parts of any big project we believe, a product, a marketing website, and documentation. With OrbitKit, you get all three, and they all consume packages from the monorepo so you end up sharing code between them really easily.

## Expectations

You should expect a learning curve with OrbitKit if you haven't worked in monorepos before or with the tools we use. But we believe that the learning curve is worth it, and we are here to help you through it with our documentation and github issues.

This starterkit is not intended for beginners, but for those who are looking for a starterkit that can take their startup idea into the real world faster than normal with your added expertise in building your product.

In simple terms, you should have experience in using React, Next.js and TypeScript. We believe if you know these three, you can pick up the rest quite easily.

## Sponsors

This project was born out of my love for open source, monorepos and DX (developer experience). A project in such a scale requires a lot of time and effort to maintain.

If OrbitKit will be useful to you, please consider [❤️ sponsoring me on GitHub](https://github.com/sponsors/ixahmedxi) so that I can continue to maintain and improve it. I appreciate your support!
Loading
Loading