Skip to content

Commit 5c9cd92

Browse files
authored
Update create-a-doodle-gallery.mdx
1 parent be69656 commit 5c9cd92

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

projects/create-a-doodle-gallery/create-a-doodle-gallery.mdx

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,20 @@ courses:
2121

2222
# # Introduction
2323

24-
I miss the days of the internet when people built cool stuff for the sake of making fun things. There were a lot of random sites that were heavily in circulation during my younger years, like [Google Doodles](https://doodles.google/search/?form_tags=interactive%20game), that embraced creativity and play. [insert an image of some examples here] Here’s a project tutorial that might help bring us back to these days — you’ll be building a website where anyone can draw a doodle for a public virtual museum exhibit!
24+
I miss the days of the internet when people built cool stuff for the sake of making fun things. There were a lot of random sites that were heavily in circulation during my younger years, like [Google Doodles](https://doodles.google/search/?form_tags=interactive%20game), that embraced creativity and play.
25+
![Google doodles]("https://www.pcworld.com/wp-content/uploads/2025/06/baseball-100900643-orig.jpg?quality=50&strip=all")
2526

26-
To make this project, we’ll be using the classic web dev tools HTML, CSS, and JavaScript, and will be storing our drawings in [Supabase](http://supabase.com/). We’ll also be using [Vite](https://vite.dev/) to get a local server running our website, that way you can run local servers with Node.js. I picked Vite because it handles imports cleanly, refreshes your website automatically with any changes, and is structured to better handle a project with a realtime database!
27+
Here’s a project tutorial that might help bring us back to these days — you’ll be building a website where anyone can draw a doodle for a public virtual museum exhibit!
28+
29+
![](./images/ezgif-509d613e7e5e8ca6.gif)
30+
31+
To make this project, we’ll be using the classic web dev tools HTML, CSS, and JavaScript, and will be storing our drawings in [Supabase](http://supabase.com/).
32+
33+
We’ll also be using [Vite](https://vite.dev/) to get a local server running our website, that way you can run local servers with Node.js. I picked Vite because it handles imports cleanly, refreshes your website automatically with any changes, and is structured to better handle a project with a realtime database!
2734

2835
# # About Supabase
2936

30-
[Supabase](https://supabase.com/) is a PostgreSQL development platform. In other words, it’s a database system that takes care of everything from setup, deployment, and application scaling, perfect for what we'll be creating today! Whenever a user draws a picture or types out text, we’re going to use Supabase to store all that information in real time, and fetch them from a bucket (aka a type of storage container) of our image-text pairs to display drawings in a public gallery!
37+
[Supabase](https://supabase.com/) is a PostgreSQL (Post-Ingres Structured Query Language) development platform. In other words, it’s a database system that takes care of everything from setup, deployment, and application scaling, perfect for what we'll be creating today! Whenever a user draws a picture or types out text, we’re going to use Supabase to store all that information in real time, and fetch them from a bucket (aka a type of storage container) of our image-text pairs to display drawings in a public gallery!
3138

3239
# # **Setting Up**
3340

@@ -49,32 +56,31 @@ create table if not exists public.drawings (
4956
created_at timestamptz not null default now()
5057
);
5158
```
52-
The interface should look like this:
53-
5459
## ## **Adding your API Keys**
5560
We need to add API keys to our project for it to connect to our storage bucket - API keys authenticate the usage of coding tools like Supabase.
5661

57-
1. Go to the API menu under Project Settings. Find your Project URL and API key. They should look something like this:
62+
Go to the API menu under Project Settings. Find your Project URL and API key. They should look something like this:
63+
![](./images/key-url-example.png)
5864

5965
## ## **Clone Template**
6066

6167
Head over to [this GitHub link](https://github.com/gbanaag/codedex-doodle-project-template#) and clone the repository. The repository takes care of all the visual and front-end work, so you can put your full focus on working with your database.
6268

6369
You can clone the template in 3 different ways:
6470

65-
- Downloading the folder and adding it to your local workspace
66-
- GitHub Desktop app
67-
- `git clone` with command line
71+
1. Downloading the folder and adding it to your local workspace
72+
2. GitHub Desktop app
73+
3. `git clone` with command line
6874

69-
If you’re curious to know what’s been coded for you already, here’s what’s already set up:The canvas interface where users can create their drawings (JavaScript)
75+
If you’re curious to know what’s been coded for you already, here’s what’s already set up: The canvas interface where users can create their drawings (JavaScript)
7076

71-
- An input box to collect captions (HTML)
72-
- Fonts, colors, the frame images, measurements (for the frames), animations, and layout choices (CSS)
73-
- Picking random frames for each drawing (JavaScript)
77+
- An input box to collect captions (HTML, `index.html`)
78+
- Fonts, colors, the frame images, measurements (for the frames), animations, and layout choices (CSS, `style.css`)
79+
- Picking random frames for each drawing (JavaScript, `main.js`)
7480

7581
You’ll be focusing on:
7682
- Creating a storage container
77-
-Setting up your website so that it can collect data
83+
- Setting up your website so that it can collect data
7884
- Displaying the data (user-created drawings and text) that’s been collected in a scrolling gallery
7985

8086
Let’s get into it! ⚡
@@ -85,28 +91,33 @@ Make sure you have the latest version of [Node.js](https://nodejs.org/en/downloa
8591

8692
Run this command in the terminal: `npm create vite@latest`, and then answer the prompts as follows. You can name your project however you like. When prompted, pick `Vanilla` as your framework and `JavaScript` as your variant. Your terminal should look like this at the end of completing the steps:
8793

94+
![](./images/vite-setup.png)
95+
8896
This might look different depending on what kind of computer you’re using — in my case, I’m on a Macbook.
8997

9098
## ## Running your server
9199

92100
To start up a server with your webpage running, type `npm run dev` in the Terminal. It’ll give you a url that looks something like: `http://localhost:3000/` — but the numbers in the URL can vary. Copy the link and paste it in your browser, and you should see something like this:
93101

102+
![](./images/vite-startup-template-screen.png)
103+
94104
## ## **.env File and API Keys**
95105

96-
In your root folder, create a new file called `.env`. An `.env` file is used to keep sensitive information like API keys and credentials secret, and use substitute names in your code instead of the actual keys or data. This is helpful if your code is publicly shared, like on GitHub for example, since it hides the API keys automatically!
106+
In your root folder, create a new file called `.env`. An `.env` file is used to keep sensitive information like API keys and credentials secret, and uses substitute names in your code instead of the actual keys or data. This is helpful if your code is publicly shared, like on GitHub for example, since it hides the API keys automatically!
97107

98108
Create two variables, `VITE_SUPABASE_URL` and `VITE_SUPABASE_ANON_KEY` and set their values to the URL and API values you found in your Supabase Project Settings.
99109

100110
```
101-
VITE_SUPABASE_URL=https://[string of characters].supabase.co
102-
VITE_SUPABASE_ANON_KEY=another_string_of_random_characters
111+
VITE_SUPABASE_URL=https://bfhrXDG80CyFxqqt.supabase.co
112+
VITE_SUPABASE_ANON_KEY=uvoNOTCBo2l7KE4mIHpdbfhrXDG80CyFxqqtLAB8RMv
103113
```
114+
(These are just examples of what API keys and URLs can look like - the ones above don't actually work!)
104115

105116
# # Submitting Drawings
106117

107118
Right now, you can draw on the canvas of the website, but you can't save or send the drawings anywhere. Once the page refreshes, the drawing disappears. We'll be coding a `submitDrawing()` function that packages up the canvas image and caption text, sends them to Supabase, and then immediately adds them to the gallery so the user can see their doodle appear in real time.
108119

109-
Start by creating the function. We’re making an `async` function — a special type of function that handles tasks external to the code we already have. In our case, we’re submitting data to container outside of the codebase.
120+
We'll start by creating the function. We’re making an `async` function — a special type of function that handles tasks external to the code we already have. In our case, we’re submitting data to container outside of the codebase.
110121

111122
```jsx
112123
async function submitDrawing() {
@@ -350,6 +361,8 @@ We want our big gallery to load random drawings, so everyone’s drawings have a
350361
351362
Then we’re going to add our batch of drawings to our marquee. If you don’t know what a marquee is, it’s a scrolling gallery, or set of text that seems to scroll infinitely!
352363
364+
![](./images/webflow-marquee-example.gif)
365+
353366
We’ll write out our function header for `repeatMarquee()`, limiting the number of drawings picked to 200. Our marquee has two rows, and if neither of them render, it’ll stop the function through the `if` statement.
354367
355368
```jsx

0 commit comments

Comments
 (0)