Code Playgrounds and Hosting
Online playgrounds let you write and share code in the browser. Hosting services put your finished website on the internet for everyone to see.
Code Playgrounds
A playground is an editor in the browser that shows the result instantly. Nothing to install, and you can share your work with a link.
| Playground | Best for |
|---|---|
| CodePen | Small HTML, CSS and JavaScript demos |
| JSFiddle | Quick tests and bug examples |
| StackBlitz | Full projects (React, Angular, Vue, Node) in the browser |
| CodeSandbox | Full front-end and back-end projects, team sharing |
| Replit | Many languages (Python, PHP, C++) |
Use playgrounds to:
- Test an idea quickly without creating a project
- Share a small example when you ask for help online
- Show a design or animation in your portfolio
Playgrounds are great for learning and demos, but keep real projects in Git on your computer and on GitHub.
What Does Hosting Mean?
To be online, your files must sit on a computer (a server) that is always on and connected to the internet. A hosting service gives you that server, plus an address like my-site.netlify.app. You can later connect your own domain, like alibakery.pk.
Static Sites vs Dynamic Sites
| Static site | Dynamic site | |
|---|---|---|
| Made of | HTML, CSS, JavaScript files | Server code + database |
| Examples | Portfolio, landing page, React app | WordPress, PHP shop, Django app |
| Free hosts | GitHub Pages, Netlify, Vercel | Limited free plans; usually paid hosting or a cloud server |
GitHub Pages, Netlify and Vercel are best for static sites and front-end frameworks.
GitHub Pages
Free hosting directly from a GitHub repository.
- Push your site to GitHub, with
index.htmlin the main folder. - In the repository, open Settings, then Pages.
- Under Build and deployment, choose Deploy from a branch, select
mainand/ (root), and click Save. - After a minute, your site is live at
https://username.github.io/repository-name/.
Example
git add .
git commit -m "Update portfolio projects"
git pushTo https://github.com/ayesha-dev/portfolio.git b2c9e04..f81a6d3 main -> main
Every push updates the live site automatically.
Netlify
- Sign up with your GitHub account.
- Click Add new site, then Import an existing project, and choose your repository.
- For a plain HTML site, leave the build command empty. For a framework, Netlify fills in settings like
npm run buildand the output folderdist. - Click Deploy. You get an address like
ali-bakery.netlify.app.
For a very quick test, you can also drag and drop a folder onto Netlify's deploy page.
Vercel
Vercel is made by the creators of Next.js and is excellent for React and Next.js apps.
- Sign up with GitHub and click Add New, Project.
- Import your repository. Vercel detects the framework automatically.
- Click Deploy.
Deployment complete Production: https://ali-bakery.vercel.app
Every pull request also gets its own preview link, so you can check changes before they go live.
Choosing a Host
| Your project | Good choice |
|---|---|
| Simple HTML/CSS portfolio | GitHub Pages or Netlify |
| React, Vue or Vite app | Netlify or Vercel |
| Next.js app | Vercel |
| WordPress or PHP site | Shared hosting with cPanel |
| Django, Node.js or ASP.NET API | A platform like Render or Railway, or a cloud server |
Never put passwords or API keys in front-end code; anyone can read it in DevTools. Hosts like Netlify and Vercel have an Environment Variables setting for secrets used during the build or on the server.
Exercise
Exercise
You built a simple portfolio with only HTML and CSS. Which option hosts it for free directly from your GitHub repository?
