Hello 👋
Really happy you're checking out how to contribute. Here you'll find a break down of the tech we're using,
If you'd like to get involved one of the best ways is to drop by the discord, say hi and let us know you're interested in contributing. All are welcome.
CadHub is a RedWood app. Simplistically this means it's a React frontend, using a serverless graphQL backend with Prisma. We are also using Tailwind to style the app. To learn more about Redwood, here are some useful links:
- Tutorial: getting started and complete overview guide.
- Docs: using the Redwood Router, handling assets and files, list of command-line tools, and more.
- Redwood Community: get help, share tips and tricks, and collaborate on everything about RedwoodJS.
Because Each CadPackage is it's own beast we opted to use Docker in order to give us lots of flexibility for setting up the environment to run there packages. The containers are run using AWS's container lambda and deployed using the serverless framework (JSCAD is an exception since it runs client-side). See our docs for more information of how this is setup.
Clone the repo, then cd
in the repo and app directory (the docs directory is for learn.cadhub)
cd cadhub/app
Install dependencies
yarn install
Setting up the db, you'll need to have a postgres installed locally, you can follow this guide.
Run the following (Note: these commands require the DATABASE_URL
env variable to be set. if you see no result when you run echo $DATABASE_URL
, you can set it with a command like export DATABASE_URL=postgres://postgres:somepassword@localhost
)
yarn rw prisma migrate dev
yarn rw prisma db seed
p.s. yarn rw prisma studio
spins up an app to inspect the db
yarn rw dev
Your browser should open automatically to http://localhost:8910
to see the web app. Lambda functions run on http://localhost:8911
and are also proxied to http://localhost:8910/.redwood/functions/*
.
If you want to access the websight on your phone use yarn redwood dev --fwd="--host <ip-address-on-your-network-i.e.-192.168.0.5>"
you can sign in to the following accounts locally
localUser1@kurthutten.com: abc123
localUser2@kurthutten.com: abc123
localAdmin@kurthutten.com: abc123
To set up the discord bot to notify when users publish new content, we're using the REST API directly, used more as a notification service rather than a bot since we are not listening to messages in the chat.
- If you're setting up the bot in a dev environment, create a new discord server (the "plus" button on the left when logged into the Discord webpage). Make note of the name of the project.
- With developer mode turned on, right click the channel you wish the bot to announce on and select "Copy ID". Add this to
.env.defaults
asDISCORD_CHANNEL_ID
. - create a new application, or navigate to an existing one.
- Create a bot within that application. Copy the bot token and add it to
.env.defaults
asDISCORD_TOKEN
. - Go to the "URL Generator" under "OAuth2" and create a URL with scope "bot" and text permission "Send Messages".
- Copy the generated URL and open it in a new tab. Follow the instructions on the page to add the bot to your discord server.
When you next start CADHub, you should see in the logs Discord: logged in as <bot name>
and you should see a startup message from the bot in the channel.
To send messages as the bot when things happen in the service, use the sendChat
helper function:
import { sendDiscordMessage } from 'src/lib/discord'
sendDiscordMessage("hello world!")
In progress, though can be seen on Figma
Docs are hosted at learn.cadhub.xyz. It includes a OpenSCAD tutorial at this point, and more is coming. The docs can be found in this repo at docs