|
1 |
| -# Create T3 App With Sign-In With Ethereum |
| 1 | +## Developer DAO Academy |
2 | 2 |
|
3 |
| -An implementation of [T3 Stack](https://create.t3.gg/) with [Sign-In With Ethereum](https://login.xyz). |
| 3 | +`Developer DAO Academy` is an open-source education platform created by the |
| 4 | +Developer DAO Foundation. |
4 | 5 |
|
5 |
| - |
| 6 | +Live site is at <https://academy.developerdao.com>. |
6 | 7 |
|
7 |
| -## Tutorials |
| 8 | +Find us on Twitter at <https://twitter.com/devdao_academy>. |
8 | 9 |
|
9 |
| -📘 Full walkthrough article on how to [Combine Sign-In With Ethereum With Create-T3-App](https://codingwithmanny.medium.com/combine-sign-in-with-ethereum-with-create-t3-app-8f54604caeeb). |
| 10 | + |
10 | 11 |
|
11 |
| -<a href="https://codingwithmanny.medium.com/combine-sign-in-with-ethereum-with-create-t3-app-8f54604caeeb"></a> |
| 12 | +## What license applies to this site's content and code? |
12 | 13 |
|
13 |
| ---- |
| 14 | +- All Developer DAO Academy website content © 2022 by Developer DAO Foundation |
| 15 | + licensed under |
| 16 | + [Attribution-NonCommercial 4.0 International](http://creativecommons.org/licenses/by-nc/4.0/). |
| 17 | +- Developer DAO Academy website code © 2022 by Developer DAO Foundation licensed |
| 18 | + under [MIT](./LICENSE). |
14 | 19 |
|
15 |
| -## Requirement |
| 20 | +## How do I get started? |
16 | 21 |
|
17 |
| -- NVM or Node `v18.15.0` |
| 22 | +Please read our [CONTRIBUTING Guide](CONTRIBUTING.md) to get started. We ask |
| 23 | +that you are a member of Developer DAO to contribute, since our project uses |
| 24 | +various Developer DAO planning and communication tools, such as Discord. |
18 | 25 |
|
19 |
| ---- |
| 26 | +## How to contribute code |
20 | 27 |
|
21 |
| - |
| 28 | +If you're new to the project, see below for setup instructions. |
22 | 29 |
|
23 |
| -With the latest version of `[email protected]` it drops the headers which doesn't allow the nonce to be read from the csrf cookie. |
| 30 | +### Considerations as you write code |
24 | 31 |
|
25 |
| -The solution to this can be found in this branch: |
| 32 | +As you're working on code, some things to think about: |
26 | 33 |
|
27 |
| -[fix/next-auth-4.21.1](https://github.com/codingwithmanny/t3-app-siwe/tree/fix/next-auth-4.21.1) |
| 34 | +- PRs should be as small as possible so they are easy to review |
| 35 | +- There are strategies you can use to keep PRs small, even if your feature is |
| 36 | + big. |
| 37 | + [How to Split Pull Requests – Good Practices, Methods and Git Strategies](https://www.thedroidsonroids.com/blog/splitting-pull-request) |
28 | 38 |
|
29 |
| ---- |
| 39 | +### What should I do before submitting the PR? |
30 | 40 |
|
31 |
| -## Getting Started |
| 41 | +- Run `yarn confirm` which will make sure your files are consistently formatted, |
| 42 | + lint the code base looking for problems and then actually building the site |
| 43 | + locally to ensure no build problems |
| 44 | +- If you see warnings or errors please fix. |
| 45 | +- Also, this step runs Prettier so some files may have changed and need to be |
| 46 | + checked in. |
32 | 47 |
|
33 |
| -Follow all these steps to get up and running locally. |
| 48 | +Now you're ready to submit your PR. |
34 | 49 |
|
35 |
| -### Dependencies |
| 50 | +Assume no one knows what your PR is about. So helpful to: |
36 | 51 |
|
37 |
| -```bash |
38 |
| -# FROM: ./ |
| 52 | +- writing a description in the PR to explain what you're fixing/adding and how |
| 53 | + to test. |
| 54 | +- if your work is based on a GitHub issue, add that in the description, though |
| 55 | + make sure you use the exact words of "Closes #123" since this will |
| 56 | + automatically close the issue when the PR is merged. Using "this refers to |
| 57 | + #123" won't do that. |
| 58 | +- send a signal that your PR is ready for review, such as asking someone to |
| 59 | + review your PR |
39 | 60 |
|
40 |
| -pnpm install; # npm install; |
41 |
| -``` |
| 61 | +### How do I review a PR? |
42 | 62 |
|
43 |
| -### Environment Variable File |
| 63 | +It's also important that people review PRs -- a great learning experience and |
| 64 | +important for an open-source project. |
44 | 65 |
|
45 |
| -```bash |
46 |
| -# FROM: ./ |
| 66 | +Some helpful things when reviewing PRs: |
47 | 67 |
|
48 |
| -cp .env.example .env; |
49 |
| -``` |
| 68 | +- **ALWAYS** download and run the code you're reviewing. Never eyeball it in the |
| 69 | + PR and approve it. |
| 70 | +- when you review a PR, please add yourself as a reviewer in GitHub so we know |
| 71 | + someone is reviewing |
| 72 | +- go through the formal GitHub review process of starting a review and then |
| 73 | + finishing with "approved" or "needs changes" |
50 | 74 |
|
51 |
| -**File:** `.env` |
| 75 | +### Who should merge the PR? |
52 | 76 |
|
53 |
| -```toml |
54 |
| -# When adding additional environment variables, the schema in "/src/env.mjs" |
55 |
| -# should be updated accordingly. |
| 77 | +Once a PR is reviewed, the author of the PR should merge, and the author should |
| 78 | +run through the live site and make sure the code is performing as expected. |
56 | 79 |
|
57 |
| -# Prisma |
58 |
| -# https://www.prisma.io/docs/reference/database-reference/connection-urls#env |
59 |
| -DATABASE_URL="file:./db.sqlite" |
| 80 | +## Project Setup |
60 | 81 |
|
61 |
| -# Next Auth |
62 |
| -# You can generate a new secret on the command line with: |
63 |
| -# openssl rand -base64 32 |
64 |
| -# https://next-auth.js.org/configuration/options#secret |
65 |
| -NEXTAUTH_SECRET="A-REALLY-LONG-SECRET-PASSWORD-32" |
66 |
| -NEXTAUTH_URL="http://localhost:3000" |
| 82 | +**Prerequisites:** |
67 | 83 |
|
68 |
| -# Next Auth Discord Provider |
69 |
| -DISCORD_CLIENT_ID="" |
70 |
| -DISCORD_CLIENT_SECRET="" |
71 |
| -``` |
| 84 | + node --version 16.x |
72 | 85 |
|
73 |
| -### Database Migration |
| 86 | +Refer to the `node` and `npm` installation with `nvm` guide in Lesson 2. A link |
| 87 | +to the guide can be found |
| 88 | +[here](https://www.notion.so/How-to-install-node-js-and-npm-67b2ab1f76f148f49f547b9156aeaf28): |
74 | 89 |
|
75 |
| -```bash |
76 |
| -# FROM: ./ |
| 90 | +**Fork this repo, clone forked repo locally and `cd` into the repo:** |
77 | 91 |
|
78 |
| -npx prisma migrate dev; |
79 |
| -``` |
| 92 | + git clone https://github.com/[YOUR GITHUB HANDLE HERE]/academy.git |
| 93 | + cd academy/ |
80 | 94 |
|
81 |
| -### Local Development |
| 95 | +**Installation and run:** |
82 | 96 |
|
83 |
| -```bash |
84 |
| -# FROM: ./ |
| 97 | + yarn install |
| 98 | + yarn dev |
85 | 99 |
|
86 |
| -pnpm dev; # npm run dev; |
| 100 | +This will create a local instance of the app running and can be viewed at |
| 101 | +`http://localhost:3000` in your browser. |
87 | 102 |
|
88 |
| -# Expected Output: |
89 |
| -# > [email protected] dev /Users/username/path/to/t3-app-siwe |
90 |
| -# > next dev |
| 103 | +Also it's handy to install the Prettier plugin for your browser. You can then |
| 104 | +use it to automatically format files. It helps keep the code base tidy, for |
| 105 | +Typescript, MDX and Markdown files. |
91 | 106 |
|
92 |
| -# ready - started server on 0.0.0.0:3000, url: http://localhost:3000 |
93 |
| -``` |
| 107 | +**VSCode Remote Containers (alternative setup)** |
| 108 | + |
| 109 | +If you use VSCode for development, we already have the configuration files for |
| 110 | +you to use |
| 111 | +[Remote Containers](https://code.visualstudio.com/docs/remote/containers) (make |
| 112 | +sure that you check the link to install the requirements to use it) to easily |
| 113 | +create an isolated development environment for your fork. After installing the |
| 114 | +minimum requirements, you can start using it following this |
| 115 | +[quickstart](https://code.visualstudio.com/docs/remote/containers#_quick-start-open-a-git-repository-or-github-pr-in-an-isolated-container-volume). |
| 116 | + |
| 117 | +**For Windows Users** |
| 118 | + |
| 119 | +You may run into setup problems if using Windows Powershell. We suggest you use |
| 120 | +WSL. |
| 121 | + |
| 122 | +## Grabbing latest version of the code |
| 123 | + |
| 124 | +**Since this is a work in progress, your local version of the app can be updated |
| 125 | +with the following commands:** |
| 126 | + |
| 127 | +Stop the locally running app with: |
| 128 | + |
| 129 | + Ctrl + C |
| 130 | + |
| 131 | +Use `git pull` for the most up-to-date version: |
| 132 | + |
| 133 | + git pull |
| 134 | + |
| 135 | +Reinstall with `yarn`: |
| 136 | + |
| 137 | + yarn install |
94 | 138 |
|
95 |
| -### Database Client (Prisma Studio) |
| 139 | +Run the updated app: |
| 140 | + |
| 141 | + yarn dev |
| 142 | + |
| 143 | +## Learn More |
| 144 | + |
| 145 | +To learn more about Next.js, take a look at the following resources: |
| 146 | + |
| 147 | +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js |
| 148 | + features and API. |
| 149 | +- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. |
| 150 | + |
| 151 | +You can check out |
| 152 | +[the Next.js GitHub repository](https://github.com/vercel/next.js/) - your |
| 153 | +feedback and contributions are welcome! |
| 154 | + |
| 155 | +## Storybook |
| 156 | + |
| 157 | +This project uses [Storybook](https://storybook.js.org/). Storybook allows us to |
| 158 | +develop components in isolation from our app. |
| 159 | + |
| 160 | +Stories are loaded from `*.stories.(mdx|js|jsx|ts|tsx)` files in any directory. |
| 161 | + |
| 162 | +To use Storybook, run the `storybook` script: |
96 | 163 |
|
97 | 164 | ```bash
|
98 |
| -# FROM: ./ |
| 165 | +yarn storybook |
| 166 | +``` |
99 | 167 |
|
100 |
| -npx prisma studio; |
| 168 | +To learn more about how to write Storybook stories, check out the official |
| 169 | +[Intro to Storybook](https://storybook.js.org/tutorials/intro-to-storybook/) |
| 170 | +tutorial. |
101 | 171 |
|
102 |
| -# Expected Output: |
103 |
| -# Environment variables loaded from .env |
104 |
| -# Prisma schema loaded from prisma/schema.prisma |
105 |
| -# Prisma Studio is up on http://localhost:5555 |
| 172 | +## Deploy on Vercel |
| 173 | + |
| 174 | +The easiest way to deploy your Next.js app is to use the |
| 175 | +[Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) |
| 176 | +from the creators of Next.js. |
| 177 | + |
| 178 | +Check out our |
| 179 | +[Next.js deployment documentation](https://nextjs.org/docs/deployment) for more |
| 180 | +details. |
| 181 | + |
| 182 | +## How do I add/edit contributors for a lesson? |
| 183 | + |
| 184 | +First make sure you add your information to `./data/contributors.ts`. Minimally |
| 185 | +you need a unique handle (a single lowercase name such as `brianfive`) which |
| 186 | +will be used to look up your information. |
| 187 | + |
| 188 | +Then add a component in your `.mdx` file at the bottom like this, using various |
| 189 | +handles defined above. |
| 190 | + |
| 191 | +You can add a contributor as an author, reviewer of contributor. Author(s) wrote |
| 192 | +the content, Reviewer(s) edited the content, and Contributor(s) later made |
| 193 | +updates or fixed issues. |
| 194 | + |
| 195 | +```jsx |
| 196 | +import { ContributorFooter } from "../../../components/mdx/ContributorFooter"; |
106 | 197 | ```
|
107 | 198 |
|
108 |
| ---- |
| 199 | +```jsx |
| 200 | +<ContributorFooter |
| 201 | + authors={["brianfive"]} |
| 202 | + reviewers={["piablo", "georgemac510"]} |
| 203 | + contributors={[]} |
| 204 | +/> |
| 205 | +``` |
109 | 206 |
|
110 |
| -built by [@codingwithmanny](https://twitter.com/codingwithmanny) |
| 207 | +## How do I add a specific forum link in a lesson's header? |
111 | 208 |
|
| 209 | +Make sure the `<LessonHeader />` component has the `discussionUrl` attribute |
| 210 | +like this: |
| 211 | + |
| 212 | +```jsx |
| 213 | +<LessonHeader |
| 214 | + title="Lesson 4: Testing your TierNFT" |
| 215 | + discussionUrl="https://developerdao.peeranha.io/discussions/1372/testing-solidity-contracts" |
| 216 | +/> |
| 217 | +``` |
112 | 218 |
|
| 219 | +Without `discussionUrl` the link will default to the home page of Peeranha. |
0 commit comments