This project is a template that allows you to quickly get started with a Typescript web application (optionally) using a devcontainer. It is setup to allow you to use all the features of VS Code without having to use the browser debugger or code-editor. It can also be used without devcontainers, or directly via GitHub via CodeSpaces.
Note that this is common infrastructure if you use devcontainers on your system for development and only needs to be installed once for any number of devcontainer-enabled repositories you want to use.
If you haven't used devcontainers, you'll be pleasantly surprised at how flexible, seamless and clean they make even the most complicated dev setup. I really recommend you check this out, it'll change your everything about how you think of dev environments and setup.
-
Install Docker on your machine if you haven't already.
-
Install VS Code
-
Install the VS Code Dev containers extension
-
Clone the repository (or use this template to create your own project):
git clone https://github.com/aniongithub/typescript-webapp-template.git
or (if you created your own project from this template)
git clone https://github.com/your-username/project-name.git
-
Open the project in Visual Studio Code.
-
When prompted, click on the "Reopen in Container" button in the bottom-right corner of the editor. You can also use the Command Palette
(Ctrl/Cmd+Shift+P)and type/chooseRebuild and Reopen in Container

-
Wait for the devcontainer to build. This might take a few minutes depending on your internet connection.

-
When the devcontainer is ready, you can use
Ctrl/Cmd+Shift+B(choosenpm:build) to build the project -
Press
F5to launch it. A new browser window will open, showing you a rotating green cube on a sky blue background.
-
You can now use breakpoints in VS Code or setup the default build task to be
npm:watchif you want any changes to automatically be compiled and available in the debug browser. Note that you may need to pressShift+F5to force the browser to refresh any changes.
- Create a new project based on this template or use this repository
- Choose the
Codedropdown and clickCreate codespace on main
- You will see Github is creating a Codespace to run this project

- When the CodeSpace is ready, you can use
Ctrl/Cmd+Shift+B(choosenpm:build) to build the project - Press
F5to launch it. Note that you can only launch the project using theServerconfiguration as we cannot launch a client-side browser from CodeSpaces. Instead, use theOpen in Browserbutton from the popup as shown below.
- You can now use breakpoints in VS Code or setup the default build task to be
npm:watchif you want any changes to automatically be compiled and available in the browser window/tab you opened. Note that you may need to pressShift+F5to force the browser to refresh any changes.
-
Clone the repository:
git clone https://github.com/aniongithub/typescript-webapp-template.git
or (if you created your own project from this template)
git clone https://github.com/your-username/project-name.git
-
Install the required dependencies:
cd project-name
npm install- Install the recommended extensions (from
.vscode/extensions.json)
- Press
F5to launch the debugger. A new browser window will open, showing you a rotating green cube on a sky blue background.You can now use breakpoints in VS Code or setup the default build task to benpm:watchif you want any changes to automatically be compiled and available in the debug browser. Note that you may need to pressShift+F5to force the browser to refresh any changes.
This project is licensed under the MIT License.