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

Engine v1 #143

Merged
merged 28 commits into from
Jun 19, 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
31 changes: 31 additions & 0 deletions .github/workflows/preview-engine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Preview Deployment - Engine
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
on:
push:
branches-ignore:
- main
paths:
- apps/engine/**
jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
# - name: 🔦 Run linter
# run: bun run lint --filter=@midday/engine
# - name: 🪐 Check TypeScript
# run: bun run typecheck --filter=@midday/engine
- name: Deploy Project Artifacts to Cloudflare
uses: cloudflare/wrangler-action@v3
with:
packageManager: bun
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
workingDirectory: "apps/engine"
wranglerVersion: "3.60.1"
command: deploy --minify src/index.ts --name=engine-staging
31 changes: 31 additions & 0 deletions .github/workflows/production-engine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Preview Deployment - Engine
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
on:
push:
branches:
- main
paths:
- apps/engine/**
jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
# - name: 🔦 Run linter
# run: bun run lint --filter=@midday/engine
# - name: 🪐 Check TypeScript
# run: bun run typecheck --filter=@midday/engine
- name: Deploy Project Artifacts to Cloudflare
uses: cloudflare/wrangler-action@v3
with:
packageManager: bun
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
workingDirectory: "apps/engine"
wranglerVersion: "3.60.1"
command: deploy --minify src/index.ts --name=engine
6 changes: 5 additions & 1 deletion apps/dashboard/.env-example
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ MISTRAL_API_KEY=

# OpenPanel
NEXT_PUBLIC_OPENPANEL_CLIENT_ID=
OPENPANEL_SECRET_KEY=
OPENPANEL_SECRET_KEY=

# Engine
ENGINE_API_ENDPOINT=http://localhost:3002
ENGINE_API_SECRET=secret
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ export type Transaction = {
status: "posted" | "excluded" | "included" | "pending" | "completed";
manual?: boolean;
date: string;
category: string;
category?: {
slug: string;
name: string;
color: string;
};
name: string;
description?: string;
currency: string;
Expand Down
4 changes: 4 additions & 0 deletions apps/dashboard/src/env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export const env = createEnv({
BASELIME_SERVICE: z.string(),
BASELIME_API_KEY: z.string(),
OPENPANEL_SECRET_KEY: z.string(),
ENGINE_API_ENDPOINT: z.string(),
ENGINE_API_SECRET: z.string(),
},
/**
* Specify your client-side environment variables schema here.
Expand Down Expand Up @@ -85,6 +87,8 @@ export const env = createEnv({
NEXT_PUBLIC_OPENPANEL_CLIENT_ID:
process.env.NEXT_PUBLIC_OPENPANEL_CLIENT_ID,
OPENPANEL_SECRET_KEY: process.env.OPENPANEL_SECRET_KEY,
ENGINE_API_ENDPOINT: process.env.ENGINE_API_ENDPOINT,
ENGINE_API_SECRET: process.env.ENGINE_API_SECRET,
},
skipValidation: !!process.env.CI || !!process.env.SKIP_ENV_VALIDATION,
});
3 changes: 2 additions & 1 deletion apps/dashboard/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"strict": true
},
"include": ["next-env.d.ts", "next.config.js", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "tailwind.config.ts"],
"exclude": ["node_modules"]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/gocardless/link
---
3 changes: 3 additions & 0 deletions apps/docs/api-reference/engine/endpoint/auth-link-plaid.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/plaid/link
---
3 changes: 3 additions & 0 deletions apps/docs/api-reference/engine/endpoint/exchange-token-1.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/plaid/exchange
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/gocardless/exchange
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/plaid/exchange
---
3 changes: 3 additions & 0 deletions apps/docs/api-reference/engine/endpoint/exchange-token.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/gocardless/exchange
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: get /accounts/balance
---
3 changes: 3 additions & 0 deletions apps/docs/api-reference/engine/endpoint/get-accounts.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: get /accounts
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: get /accounts/balance
---
3 changes: 3 additions & 0 deletions apps/docs/api-reference/engine/endpoint/get-auth-link.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/gocardless/link
---
3 changes: 3 additions & 0 deletions apps/docs/api-reference/engine/endpoint/get-health.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: get /health
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: get /institutions/search
---
3 changes: 3 additions & 0 deletions apps/docs/api-reference/engine/endpoint/get-link.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/plaid/link
---
3 changes: 3 additions & 0 deletions apps/docs/api-reference/engine/endpoint/get-transactions.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: get /transactions
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/gocardless/link
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/gocardless/exchange
---
3 changes: 3 additions & 0 deletions apps/docs/api-reference/engine/endpoint/health.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: get /health
---
3 changes: 3 additions & 0 deletions apps/docs/api-reference/engine/endpoint/plaid-auth-link.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/plaid/link
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/plaid/exchange
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/gocardless/exchange
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/gocardless/link
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/plaid/exchange
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /auth/plaid/link
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: get /institutions/search
---
30 changes: 30 additions & 0 deletions apps/docs/api-reference/engine/introduction.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: "Introduction"
"og:title": "Midday Engine API Reference - Introduction"
description: "Fundamental concepts of Midday Engine API."
icon: webhook
---

<Info>
Midday Engine is currently in beta. If you have any questions or feedback,
please reach out to us at
[support@midday.ai](mailto:support@midday.ai?subject=Engine%20API%20API)
</Info>

## Base URL

Midday Engine API is built on REST principles and is served over HTTPS. To ensure data privacy, unencrypted HTTP is not supported.

The Base URL for all API endpoints is:

```bash Terminal
https://engine-api.midday.ai
```

## Authentication

Authentication to Midday Engine API is performed via the Authorization header with a Bearer token. To authenticate, you need to include the Authorization header with the word `Bearer` followed by your token in your API requests like so:

```bash Terminal
Authorization: Bearer <Your-Token>
```
6 changes: 6 additions & 0 deletions apps/docs/examples.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: "Examples"
"og:title": "Midday API Examples - Build with the Midday API"
description: "Explore ideas and examples of what you can build with the Midday API"
icon: github
---
Binary file added apps/docs/images/header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions apps/docs/integrations.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: "Integrations"
"og:title": "Midday Integrations: Connect Midday to services"
description: "Integrate Midday with your services."
icon: object-union
---
16 changes: 16 additions & 0 deletions apps/docs/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,20 @@
title: Introduction
"og:title": "Getting Started with Midday.ai - Documentation"
description: "Midday.ai | Run your business smarter."
icon: rocket
---

<Frame>
<img src="/images/header.png" alt="Midday header" width="1200" height="630" />
</Frame>

You can self-host Midday on your own cloud infrastructure for greater control over your data. This guide will walk you through the entire process of setting up Midday.

## Prerequisites

Before you begin, make sure you have the following:

- A [GitHub](https://github.com/) account
- An [Upstash](https://upstash.com/) account
- A [Supabase](https://supabase.com/) account
- A [Vercel](https://vercel.com/) account
1 change: 1 addition & 0 deletions apps/docs/local-development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
title: "Local Development"
"og:title": "How to setup Midday.ai for Local Development"
description: "A guide on how to run Midday.ai's codebase locally."
icon: code
---
39 changes: 32 additions & 7 deletions apps/docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@
"name": "Dashboard",
"url": "https://app.midday.ai"
},
"openapi": "https://api.midday.ai",
"openapi": "https://engine.midday.ai/openapi",
"tabs": [
{
"name": "API Reference",
"url": "api-reference"
"name": "Engine API Reference",
"url": "api-reference/engine"
}
],
"anchors": [
{
"name": "Help Center",
"icon": "question",
"url": "https://midday.ai/help"
"url": "https://midday.ai/support"
},
{
"name": "GitHub",
Expand All @@ -52,11 +52,35 @@
"navigation": [
{
"group": "Getting Started",
"pages": ["introduction", "local-development", "self-hosting"]
"pages": ["introduction"]
},
{
"group": "Resources",
"pages": ["integrations", "sdks", "examples"]
"pages": ["integrations", "examples"]
},
{
"group": "Open source",
"pages": ["local-development", "self-hosting"]
},
{
"group": "Engine API Reference",
"pages": [
"api-reference/engine/introduction"
]
},
{
"group": "Links",
"pages": [
"api-reference/engine/endpoint/get-transactions",
"api-reference/engine/endpoint/get-accounts",
"api-reference/engine/endpoint/get-account-balance",
"api-reference/engine/endpoint/search-institutions",
"api-reference/engine/endpoint/auth-link-gocardless",
"api-reference/engine/endpoint/exchange-token-gocardless",
"api-reference/engine/endpoint/auth-link-plaid",
"api-reference/engine/endpoint/exchange-token-plaid",
"api-reference/engine/endpoint/health"
]
}
],
"api": {
Expand All @@ -68,6 +92,7 @@
"footerSocials": {
"twitter": "https://twitter.com/middayai",
"github": "https://git.new/midday",
"website": "https://midday.ai"
"website": "https://midday.ai",
"linkedin": "https://www.linkedin.com/company/midday-ai"
}
}
10 changes: 10 additions & 0 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@midday/docs",
"scripts": {
"dev": "mintlify dev --port 3004",
"generate:engine": "bunx @mintlify/scraping@latest openapi-file http://localhost:3002/openapi -o api-reference/engine/endpoint"
},
"devDependencies": {
"mintlify": "^4.0.170"
}
}
6 changes: 4 additions & 2 deletions apps/docs/self-hosting.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
title: "Self-hosting Midday.ai"
"og:title": "How to self-host Midday.ai"
title: "Self-hosting Midday"
"og:title": "How to self-host Midday in 8 easy steps"
description: "An end-to-end guide on how to self-host Midday"
icon: server
---
Loading
Loading