r/typescript • u/tauqeernasir • Apr 14 '26
Typescript/Javascript Server pages - Something very close to PHP like
I was wondering if we have something very close to PHP-like way of building web-apps where we can use JS/TS inside <% %> blocks and have them run in the backend and only return HTML pages. I couldn't really find similar thing so tried to build myself to see if prototype work or not.
NOTE: I am not PHP developer and haven't really touched it for almost a decade but I wanted to try something.
I did something that I will share soon but I was able to create a framework that allows very similar way of writing webpages. Look at the example below
It currently supports, layouts, partials, <% %> blocks and built-in support of TS and continuous blocks like <% if (true) { %> ... <% } %>. I also added support for cookies and sessions similar to how PHP does it. I also worked on syntax highlighter and a custom language server which gives auto-completions, linting warnings etc.
I was able to build a quick prototype of a notes apps using sqlite database and it worked without any issues so far.

What do you guys think about this? Do you see a real use case in this framework which is batteries included and just works by adding pages and public directory and it just serves pages? Any ideas if this can be made better and adapted?