Skip to content

Commit

Permalink
Merge pull request Budibase#5174 from Budibase/develop
Browse files Browse the repository at this point in the history
Develop -> Master
  • Loading branch information
shogunpurple authored Mar 30, 2022
2 parents b8678e2 + 0e309ac commit c5672e7
Show file tree
Hide file tree
Showing 186 changed files with 14,754 additions and 5,131 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@
],
"rules": {
"no-self-assign": "off"
},
"globals": {
"GeolocationPositionError": true
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ hosting/proxy/.generated-nginx.prod.conf
bin/
hosting/.generated*
packages/builder/cypress.env.json
stats.html
11 changes: 9 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@
"name": "Budibase Worker",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/packages/worker/src/index.js",
"runtimeArgs": [
"--nolazy",
"-r",
"ts-node/register/transpile-only"
],
"args": [
"${workspaceFolder}/packages/worker/src/index.ts"
],
"cwd": "${workspaceFolder}/packages/worker"
}
},
],
"compounds": [
{
Expand Down
43 changes: 37 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
The low code platform you'll enjoy using
</h3>
<p align="center">
Budibase is an open source low-code platform, and the easiest way to build internal tools that improve productivity.
Budibase is an open source low-code platform, and the easiest way to build internal apps that improve productivity.
</p>

<h3 align="center">
Expand Down Expand Up @@ -40,9 +40,11 @@
</p>

<h3 align="center">
<a href="https://docs.budibase.com/getting-started">Get started</a>
<a href="https://account.budibase.app/register">Get started - we host (Budibase Cloud)</a>
<span> · </span>
<a href="https://docs.budibase.com">Docs</a>
<a href="https://docs.budibase.com/docs/hosting-methods">Get started - you host (Docker, K8s, DO)</a>
<span> · </span>
<a href="https://docs.budibase.com/docs">Docs</a>
<span> · </span>
<a href="https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas">Feature request</a>
<span> · </span>
Expand Down Expand Up @@ -100,16 +102,45 @@ Budibase is made to scale. With Budibase, you can self-host on your own infrastr

- Checkout the promo video: https://youtu.be/xoljVpty_Kw

<br />

---

<br />


## Budibase Public API
As with anything that we build in Budibase, our new public API is simple to use, flexible, and introduces new extensibility. To summarize, the Budibase API enables:

- Budibase as a backend
- Interoperability


#### Docs
You can learn more about the Budibase API at the following places:

- [General documentation](https://docs.budibase.com/docs/public-api) : Learn how to get your API key, how to use spec, and how to use with Postman
- [Interactive API documentation](https://docs.budibase.com/reference/post_applications) : Learn how to interact with the API

#### Guides

- [Build an app with Budibase and Next.js](https://budibase.com/blog/building-a-crud-app-with-budibase-and-next.js/)

<p align="center">
<img alt="Budibase data" src="https://res.cloudinary.com/daog6scxm/image/upload/v1647858558/Feb%20release/Start_building_with_Budibase_s_API_3_rhlzhv.png">
</p>
<br /><br />

<br /><br /><br />

## 🏁 Get started

<a href="https://docs.budibase.com/self-hosting/self-host"><img src="https://res.cloudinary.com/daog6scxm/image/upload/v1634808888/logo/deploy_npl9za.png" /></a>
<a href="https://docs.budibase.com/docs/hosting-methods"><img src="https://res.cloudinary.com/daog6scxm/image/upload/v1634808888/logo/deploy_npl9za.png" /></a>

Deploy Budibase self-hosted in your existing infrastructure, using Docker, Kubernetes, and Digital Ocean.
Or use Budibase Cloud if you don't need to self-host, and would like to get started quickly.

### [Get started with self-hosting Budibase](https://docs.budibase.com/self-hosting/self-host)
### [Get started with self-hosting Budibase](https://docs.budibase.com/docs/hosting-methods)

### [Get started with Budibase Cloud](https://budibase.com)

Expand All @@ -118,7 +149,7 @@ Or use Budibase Cloud if you don't need to self-host, and would like to get star

## 🎓 Learning Budibase

The Budibase documentation [lives here](https://docs.budibase.com).
The Budibase documentation [lives here](https://docs.budibase.com/docs).
<br />


Expand Down
4 changes: 4 additions & 0 deletions charts/budibase/templates/app-service-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ spec:
value: {{ .Values.globals.cookieDomain | quote }}
- name: HTTP_MIGRATIONS
value: {{ .Values.globals.httpMigrations | quote }}
- name: GOOGLE_CLIENT_ID
value: {{ .Values.globals.google.clientId | quote }}
- name: GOOGLE_CLIENT_SECRET
value: {{ .Values.globals.google.secret | quote }}
image: budibase/apps:{{ .Values.globals.appVersion }}
imagePullPolicy: Always
name: bbapps
Expand Down
3 changes: 3 additions & 0 deletions examples/nextjs-api-sales/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
38 changes: 38 additions & 0 deletions examples/nextjs-api-sales/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel

# typescript
*.tsbuildinfo
41 changes: 41 additions & 0 deletions examples/nextjs-api-sales/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Budibase API + Next.js example

This is an example of how Budibase can be used as a backend for a Postgres database for a Next.js sales app. You will
need to follow the walk-through that has been published in the Budibase docs to set up your Budibase app for this example.

## Pre-requisites

To use this example you will need:
1. [Docker](https://www.docker.com/)
2. [Docker Compose](https://docs.docker.com/compose/)
3. [Node.js](https://nodejs.org/en/)
4. A self-hosted Budibase installation

## Getting Started

The first step is to set up the database - you can do this by going to the `db/` directory and running the command:

```bash
docker-compose up
```

The next step is to follow the example walk-through and set up a Budibase app as it describes. Once you've done
this you can configure the settings in `next.config.js`, specifically the `apiKey`, `host` and `appName`.

Finally, you can start the dev server with the following command:

```bash
npm run dev
# or
yarn dev
```

## Accessing the app

Open [http://localhost:3001](http://localhost:3001) with your browser to see the sales app.

Look in the API routes (`pages/api/sales.ts` and `pages/api/salespeople.ts`) to see how this is integrated with Budibase.
There is also a utility file where some core functions and types have been defined, in `utilities/index.ts`.

## Attribution
This example was set up using [Next.js](https://nextjs.org/) and bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
42 changes: 42 additions & 0 deletions examples/nextjs-api-sales/components/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import Link from "next/link"
import Image from "next/image"
import { ReactNotifications } from "react-notifications-component"

function layout(props: any) {
return (
<>
<nav className="navbar" role="navigation" aria-label="main navigation">
<div id="navbar" className="navbar-menu">
<div className="logo">
<Image alt="logo" src="/bb-emblem.svg" width="50" height="50" />
</div>
<div className="navbar-start">
<Link href="/">
<a className="navbar-item">
List
</a>
</Link>
<Link href="/save">
<a className="navbar-item">
New sale
</a>
</Link>
</div>
<div className="navbar-end">
<div className="navbar-item">
<div className="buttons">
<a className="button is-primary" href="https://budibase.readme.io/reference">
<strong>API Documentation</strong>
</a>
</div>
</div>
</div>
</div>
</nav>
<ReactNotifications />
{props.children}
</>
)
}

export default layout
28 changes: 28 additions & 0 deletions examples/nextjs-api-sales/components/notifications.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Store } from "react-notifications-component"

const notifications = {
error: (error: string, title: string) => {
Store.addNotification({
container: "top-right",
type: "danger",
message: error,
title: title,
dismiss: {
duration: 10000,
},
})
},
success: (message: string, title: string) => {
Store.addNotification({
container: "top-right",
type: "success",
message: message,
title: title,
dismiss: {
duration: 3000,
},
})
},
}

export default notifications
17 changes: 17 additions & 0 deletions examples/nextjs-api-sales/db/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: "3.8"
services:
db:
container_name: postgres
image: postgres
restart: always
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: postgres
ports:
- "5432:5432"
volumes:
- pg_data:/var/lib/postgresql/data/
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
volumes:
pg_data:
21 changes: 21 additions & 0 deletions examples/nextjs-api-sales/db/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
CREATE TABLE IF NOT EXISTS sales_people (
person_id SERIAL PRIMARY KEY,
name varchar(200) NOT NULL
);

CREATE TABLE IF NOT EXISTS sales (
sale_id SERIAL PRIMARY KEY,
sale_name varchar(200) NOT NULL,
sold_by INT,
CONSTRAINT sold_by_fk
FOREIGN KEY(sold_by)
REFERENCES sales_people(person_id)
);

INSERT INTO sales_people (name)
select 'Salesperson ' || id
FROM GENERATE_SERIES(1, 50) as id;

INSERT INTO sales (sale_name, sold_by)
select 'Sale ' || id, floor(random() * 50 + 1)::int
FROM GENERATE_SERIES(1, 200) as id;
7 changes: 7 additions & 0 deletions examples/nextjs-api-sales/definitions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { components } from "./openapi"

export type App = components["schemas"]["applicationOutput"]["data"]
export type Table = components["schemas"]["tableOutput"]["data"]
export type TableSearch = components["schemas"]["tableSearch"]
export type AppSearch = components["schemas"]["applicationSearch"]
export type RowSearch = components["schemas"]["searchOutput"]
Loading

0 comments on commit c5672e7

Please sign in to comment.