JavaScripted
JavaScripting y'all
๐ฑ /JuditKaramazov
๐ Portfolio
โ Blog
Table of Contents
๐ง Getting started
Frameworks, libraries, constant changes, improvements, failures, stories of success... Some things never die, though - like my love story with Astro's developer-friendly features and flexibility, TypeScript and its type safety, or the beautiful React, always covering my astronaut's back with dynamic interactivity and reusable components... Am I getting old? Did I simply find what could potentially be the end of me? Whatever the case: Yes, indeed. Here we go again, fellow Skytroopers!
Just in case you'd want to get started with Astro and its impeccable results, allow me to say that doing so couldn't be easier - and I'll show you why, right here, right now. Step by step, though!
First, open your terminal and run the following command:
npm create astro@latest
Don't forget that you'll find Starter Templates, too:
# create a new project with an official example
npm create astro@latest -- --template <example-name>
# create a new project based on a GitHub repositoryโs main branch
npm create astro@latest -- --template <github-username>/<github-repo>
Finally:
npm run dev
๐ Project Structure
If you are interested in playing with my own project, remember that you can always clone the repository:
$ git clone https://github.com/JuditKaramazov/JavaScripted.git
In this particular case, you'll find the following folders and files:
/
โโโ public/
โ โโโ favicon.ico
โ โโโ fonts
โ โโโ img
โ โโโ meta
โโโ src/
โ โโโ components/
โ โ โโโ Button.astro
โ โโโ layouts/
โ โ โโโ Layout.astro
โ โโโ pages/
โ โ โโโ index.astro
โ โโโ sections/
โ โ โโโ Home.astro
โโโ package.json
Astro looks for .astro or .md files in the src/pages/ directory. Each page is exposed as a route based on its file name.
There's nothing special about src/components/, but that's where I usually like to put any of my Astro/React/Svelte components.
Any static assets, like images, can be placed in the public/ directory. Ask Vercel about it!
๐ง Commands
Finally, remember that all commands are run from the root of the project, from a terminal:
| Command |
Action |
npm install |
Installs dependencies |
npm run dev |
Starts local dev server at localhost:3000 |
npm run build |
Build your production site to ./dist/ |
npm run preview |
Preview your build locally, before deploying |
npm run astro ... |
Run CLI commands like astro add, astro check |
npm run astro --help |
Get help using the Astro CLI |
Easy, right? Feel free to check Astro's documentation or jump into their Discord server. Enjoy the ride, dear astronaut! ๐๐งโ๐
[!TIP]
Whatever you decide to do, please remember to respect the Code of Conduct while interacting with the project and the platform itself. Thank you kindly!
๐ช Introduction
Not so long ago, while having a look at my old notebooks, I found a bunch of them dedicated to JavaScript exclusively. In all honesty, it sent chills down my spine; although it feels like it's been ages since I started struggling with all these programming concepts and headaches, the truth is that I immersed myself into this universe in "recent" times. Jumping into the unknown - what a concept for someone who spent so many years exploring the void and unveiling the multifaceted nature of emptiness.
That's perhaps the right word: "Emptiness". While mystical intelligence becomes an open window into such a heavy-weighted concept, this "emptiness" is exactly what I felt while turning pages and pages filled with notes, diagrams, and code snippets. "Never forgive, never forget", yet the sudden urge to keep those memories intact made me feel that I had to "react" (ha, ha), fast and furious style.
If it was helpful for me, perhaps it could be useful for someone else, right?

As some of you probably know, I started a multilayered project focused on a very simple idea: Sharing legally and freely for better learning must be a priority, as the lack of universal access to effective educational resources remains a global problem. Inevitably, although I already wrote chapters and chapters discussing online websites, books, lists of free, online, and certified learning resources, or courses and cheatsheets that I myself prepared, I had to find some space for the language that started it all before Python put several concepts in their rightful place: JavaScript.
That's why JavaScripted exists: "Once a teacher, always a teacher", and this modern collection of JavaScript notes on several topics totally communicates this teacher mindset I can't get rid of.
These days, learning has become not only a need but a reasonable reality; if you have access to an internet connection, you are good to go. It's not always so simple to find the materials appropriately accommodated to our personal way of learning, though, and even though you'll encounter better JavaScript notes, code snippets, and interactive templates out there, why wouldn't I share mine?
They might become someone else's lighthouse when everything is perceived as wrong, heavy, and purposeless...
๐ฎ Features

... But speaking of lighthouses! It seems I'm consecutively getting worse and worse at keeping my "Best Practices" in good shape, but there's always room for improvement!
Just like everything I've been developing lately, I tried my best to keep JavaScripted simple, clean, accessible, and still as performant and updated as possible, though. Undoubtedly, Astro played a huge part in it, yet I won't deny that sometimes (just sometimes, guys. Don't overestimate me), I find myself scratching (and mostly, breaking) my head in order to come up with the best practices and ideas.
"What did you do this time, Judit? Thank you for asking, inexistent interlocutor! Let's see the terrible ๐ฅm e s s๐ฅ that I created this time in detail.
๐ Accessible
I won't deny that I'm still a freshman with whatever has to do with the concept of Accessibility. However, I consider it essential to shift our mindset and view this idea as an integral part of the development process rather than an afterthought, and thanks to what I learned in previous projects, you'll be capable of navigating JavaScripted by using:
Keyboard ๐ป
VoiceOver ๐๏ธ
[!TIP]
Remember that you can turn on VoiceOver on an iPhone running IOS 17 or later. This can be done from settings -> Accessibility -> VoiceOver.
๐ญ Custom theme for code snippets
It might sound like a fairytale written by an excentric man dressed as a dwarf, but back in the day, I created some Visual Studio Code custom themes based on Evangelion's aesthetics, which you can find either in the Marketplace, either in my EVASCode dedicated repository. Guess what? Yes, indeed: She did it again!
Although I won't deny the process might be tedious, the results are quite neat:
Ah, but before achieving such results... The theme itself includes:
Dark theme: Custom dark theme designed for readability and minimal eye strain.
Semantic Highlighting: Special token coloring for enums, constants, operators, and functions.
Token Colors:
- Enums, constants, and default libraries.
- Math-related properties.
- Function parameters and punctuation.
- Logical and bitwise operators.
- Keywords and control elements:.
- Strings.
Support for JS/TS: Enhanced token support for JavaScript and TypeScript, including syntax for imports, functions, modules, and console statements.
Preload Fonts: Optimized for web performance by preloading custom fonts for better visual aesthetics.
If you're the curious type and would want to see more about it, don't hesitate to have a look at:
๐จ Dynamic OG image generation
Little reminder time: OG ("Open Graph") images are the social pictures displayed whenever we share our website URL on platforms such as Twitter, WhatsApp, Discord, etc., and guess what? They help your content stand out, attract clicks, and encourage engagement. Much to our human, idealist soul, they are an essential part of digital marketing - and we all do love marketing, don't we? Just like we love our repositories to be starr-...
Ahem. So! In order to avoid the static usage of the same image being displayed over and over again, and thanks to both Satori's library and some personal tweaks, it's been possible to generate dynamic OG images at build time for each lesson or section of JavaScripted, now featuring:
Site title.
Some self-love.
Lesson's title.
Lesson's description.
Thanks to the SVG generation with Satori, the dynamic font handling, and the asynchronous nature of reading files and filtering .mdx files... boom! Easy peasy, as you'll see for the latest example:
const dir = "./src/content/lessons"; // Defines content directory.
try {
const files = await readdir(dir); // Reads all files in the directory.
const logo = await readFile(
new URL("./public/img/icons/javascripted-logo.svg", import.meta.url),
{
encoding: "base64",
width: 300,
height: 44,
}
);
for (const file of files) {
if (extname(file) !== ".mdx") {
continue; // Skips non-mdx files.
}
const content = await readFile(join(dir, file), "utf8");
const result = matter(content); // Extracts frontmatter.
await generateOgImage({
title: result.data.name,
slug: result.data.name.toLowerCase(),
description: result.data.tagline,
logo,
});
}
} catch (err) {
console.error("Error:", err);
}
Although this is not difficult to integrate at all, please feel free to check the code for further information:
๐ฆ Codesandbox-ed
A picture is worth a thousand words - now imagine the value of embedded sandboxes! As mentioned above, my notes were handwritten ones, meaning that in many cases, I had to draw entire components and deglosse their behavior just so that my mind could process what was supposed to happen when running a specific chunk of code. No more wild imagination is required