-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first commit for lite version of orbis web forum
- Loading branch information
Showing
74 changed files
with
19,683 additions
and
5,476 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# ----------------------------------------------------------------------------- | ||
# App | ||
# ----------------------------------------------------------------------------- | ||
NEXT_PUBLIC_APP_URL=http://localhost:3000 | ||
|
||
# You can generate a new secret on the command line with: | ||
# openssl rand -base64 32 | ||
AUTH_SECRET= | ||
|
||
NEXT_PUBLIC_THIRDWEB_ID="" | ||
|
||
NEXT_PUBLIC_PROJECT_ID="" | ||
|
||
# OrbisDB Personal Environment ID (your did:pkh) | ||
NEXT_PUBLIC_ENV_ID="" | ||
|
||
# OrbisDB Table Identifiers | ||
NEXT_PUBLIC_POST_ID="" | ||
NEXT_PUBLIC_COMMENT_ID="" | ||
NEXT_PUBLIC_PROFILE_ID="" | ||
|
||
# OrbisDB Context Identifier | ||
NEXT_PUBLIC_CONTEXT_ID="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,31 @@ | ||
{ | ||
"extends": ["next/core-web-vitals", "next/typescript"] | ||
"$schema": "https://json.schemastore.org/eslintrc", | ||
"root": true, | ||
"extends": [ | ||
"next/core-web-vitals", | ||
"prettier", | ||
"plugin:tailwindcss/recommended" | ||
], | ||
"plugins": ["tailwindcss"], | ||
"rules": { | ||
"@next/next/no-html-link-for-pages": "off", | ||
"react/jsx-key": "off", | ||
"tailwindcss/no-custom-classname": "off", | ||
"tailwindcss/classnames-order": "error" | ||
}, | ||
"settings": { | ||
"tailwindcss": { | ||
"callees": ["cn"], | ||
"config": "tailwind.config.ts" | ||
}, | ||
"next": { | ||
"rootDir": true | ||
} | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"parser": "@typescript-eslint/parser" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dist | ||
node_modules | ||
.next | ||
build | ||
.contentlayer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,89 @@ | ||
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). | ||
# DeForum - A Web Forum on OrbisDB | ||
|
||
## Getting Started | ||
A web forum demo application built on OrbisDB. | ||
|
||
![deforum screenshot](./public/forum.png) | ||
|
||
## Introduction | ||
|
||
This application emulates a web forum, complete with posts, comments, images, and personal profiles. It relies on the following items: | ||
|
||
**OrbisDB on Ceramic** - A decentralized database to hold the various forum artifacts users create (such as posts, comments, etc.) | ||
**ThirdWeb SDK** - Uses their IPFS upload feature for image file storage | ||
|
||
First, run the development server: | ||
## Installation | ||
|
||
First, create a local clone of the application: | ||
|
||
```bash | ||
npm run dev | ||
# or | ||
yarn dev | ||
# or | ||
pnpm dev | ||
# or | ||
bun dev | ||
git clone https://github.com/ceramicstudio/deforum && cd deforum | ||
``` | ||
|
||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
Next, install your dependencies: | ||
|
||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. | ||
```bash | ||
pnpm install | ||
``` | ||
|
||
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. | ||
### Environment Setup | ||
|
||
## Learn More | ||
You will need to create a copy of the example environment file: | ||
|
||
```bash | ||
cp .env.example .env.local | ||
``` | ||
|
||
First, create a value for `AUTH_SECRET` (will be required if you ever decide to re-integrate some of the other services that rely on NextAuth): | ||
|
||
```bash | ||
openssl rand -base64 32 | ||
``` | ||
|
||
**ThirdWeb** | ||
|
||
Next, you will need a value for your `NEXT_PUBLIC_THIRDWEB_ID`. Log into your [ThirdWeb Dashboard](https://thirdweb.com/dashboard) and go to the "Settings" tab on the upper left-hand side. Create a new API key with "Storage" as an enabled service with read + write access. Once done, copy the "Client ID" and assign it to your env value. | ||
|
||
**WalletConnect** | ||
|
||
To learn more about Next.js, take a look at the following resources: | ||
You will also need to obtain a Client ID from WalletConnect as the demo uses it for its wallet provider. Log into your [WalletConnect Cloud Dashboard](https://cloud.walletconnect.com/) and create a new project (with the "App" type selected). Once created, copy the "Project ID" and assign it to `NEXT_PUBLIC_PROJECT_ID`. | ||
|
||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. | ||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
**OrbisDB** | ||
|
||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! | ||
The next few values will be associated with OrbisDB. To make things simple, we will use the hosted [OrbisDB Studio](https://studio.useorbis.com/) and the shared node instance it provides for this demo, but keep in mind that you can set up your own instance whenever you want (more details at [OrbisDB](https://useorbis.com/)). | ||
|
||
## Deploy on Vercel | ||
First, go ahead and sign in with your wallet. | ||
|
||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. | ||
Once signed in, the studio will default to the "Contexts" tab at the top. On the right-hand side you will see your environment ID. Go ahead and assign that value to `ENV_ID` in your new .env file. | ||
|
||
Next, set up a context. These help developers segment their data models and usage based on the applications they are meant for. Create a new context (you can call it "forum-app" if you'd like), and assign the resulting string to `CONTEXT_ID` in your .env file. | ||
|
||
Finally, you will create three tables using the OrbisDB model builder feature that this application will use for storing user data. | ||
|
||
In your Orbis Studio view, select the "Model Builder" tab at the top and create a new model named "profile" using the profile definition in [this document](models/tables.sql). Once created, assign the resulting identifier to `NEXT_PUBLIC_PROFILE_ID`. Do the same for comment --> `NEXT_PUBLIC_COMMENT_ID` and post --> `NEXT_PUBLIC_POST_ID`. | ||
|
||
## Getting Started | ||
|
||
You are now ready to run the application. | ||
|
||
Running in developer mode: | ||
|
||
```bash | ||
pnpm dev | ||
``` | ||
|
||
Building: | ||
|
||
```bash | ||
pnpm build | ||
``` | ||
|
||
## Credits | ||
|
||
This project was adapted from the [NextJS Saas Stripe Starter](https://github.com/mickasmt/next-saas-stripe-starter), created by [@miickasmt](https://twitter.com/miickasmt) in 2023, released under the [MIT license](https://github.com/shadcn/taxonomy/blob/main/LICENSE.md). | ||
|
||
## Learn More | ||
To learn more about OrbisDB please visit the following links | ||
|
||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. | ||
[OrbisDB Overview](https://developers.ceramic.network/docs/orbisdb/overview) | ||
[OrbisDB SDK](https://developers.ceramic.network/docs/orbisdb/orbisdb-sdk) | ||
[OrbisDB Website](https://useorbis.com/) |
Oops, something went wrong.