The playground lets you write TypeScript (or JavaScript) online in a safe and shareable way.
Deno is a simple, modern, and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust.
- Secure by default. No file, network, or environment access, unless explicitly enabled.
- Supports TypeScript out of the box.
- Ships only a single executable file.
- Has built-in utilities like a dependency inspector (
deno info
) and a code formatter (deno fmt
). - Has a set of reviewed (audited) standard modules that are guaranteed to work with Deno: deno.land/std
Learn more on Deno's public site.
There are two packages inside the project:
- Serverless Deno back-end (built on vercel-deno)
- Next.js front-end
.
└─ 📂 packages
├─ 📦 functions
└─ 📦 ui
You can get this site up and running on your local dev environment with these five steps:
-
Install the Vercel CLI
npm i -g vercel
-
Clone this repository from GitHub
Clone deno-playground project from GitHub with the following command:
git clone git@github.com:peterbartha/deno-playground.git
-
Install yarn dependencies
Next, move into
deno-playground
directory and start it up:cd deno-playground/ yarn
-
Start dev server
# start Vercel in dev mode vercel dev # Set up and develop “.../deno-playground”? [Y/n] Y # Which scope should contain your project? <Your name> # Found project “<your_nickname>/deno-playground”. Link to it? [Y/n] N # Link to different existing project? [Y/n] Y # What’s the name of your existing project? deno-playground-api # 🔗 Linked to peterbartha/deno-playground-api (created .vercel) # Ready! Available at http://localhost:3000
-
Setup HTTPS on local development server
mkcert is the recommended option here which is simpler than the alternatives. mkcert will create a CA and SSL Certificate for the server for you.
- Install mkcert.
mkcert -install
will generate a CA first.- Generate a certificate for localhost with
mkcert localhost
. - This will generate a certificate and a key named as
*.pem
and*-key.pem
respectively. - Copy generated
*.pem
files to thepackages/ui/scripts/
folder.
-
Start the site in
dev
mode# use a different shell cd packages/ui yarn run dev
The easiest way to deploy this project is to use the Vercel Platform from the creators of Next.js.
Unfortunately, to connect multiple Vercel projects with the same Git repository, you need to create a new project for each of the packages within this Git repository.
This project uses the following open-source packages:
There are a few build environment variables that you may configure for your serverless functions:
Name | Description | Default |
---|---|---|
SCRIPT_EXECUTION_TIMEOUT |
Time-based execution limit for the build-time in ms. | 10000 |
DEBUG |
Enables additional logging during build-time. | false |
DENO_TSCONFIG |
Passes the --config flag to specify a tsconfig.json file that Deno will use. |
None |
DENO_UNSTABLE |
Passes the --unstable flag to deno cache (at build-time) and deno run (at runtime). |
false |
DENO_VERSION |
Version of deno that the serverless function will use. |
1.9.2 |
If you have any ideas, just open an issue and tell me what you think.
If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome.
This project is licensed under MIT license.