Launch HN: Wasp (YC W21) – DSL for building full-stack web apps
We are Martin and Matija, twin brothers and creators of Wasp (https://wasp-lang.dev). Wasp is a declarative language that makes it really easy to build full-stack web apps while still using the latest technologies such as React, Node.js and Prisma.
Martin and I both studied computer science where we mostly focused on algorithms for bioinformatics. Afterwards we led engineering teams in several SaaS companies, on the way gaining plenty of experience in building web apps.
Moving from one project to another, we used various technologies: JQuery -> Backbone -> Angular -> React, own scripts / makefile -> Grunt -> Gulp -> Webpack, PHP -> Java -> Node.js, … , and we always felt that things are harder than they should be. We were spending a lot of time adopting the latest tech stack and figuring out the best practices: how to make the web app performant, scalable, economical and secure and also how to connect all the pieces of the stack together.
While the tech stack kept advancing rapidly, the core requirements of the apps we were building changed very little (auth, routing, data model CRUD, ACL, …). That is why about 1.5 years ago we started thinking about separating web app specification (what it should do) from its implementation (how it should do it).
This led us to the idea of extracting common web app features and concepts into a special specification language from which we could generate code in the currently popular technologies. We don’t think it is feasible to replace everything with a single language so that is why we went with a DSL which integrates with the modern stack (right now React, NodeJS, Prisma).
Wasp lets you define high-level aspects of your web app (auth, routing, ACL, data models, CRUD) via a simple specification language and then write your specific logic in React and Node.js. The majority of the code is still being written in React and Node.js, with Wasp serving as the backbone of your whole application. To see some examples of what the language looks like in practice, take a look here: https://github.com/wasp-lang/wasp/blob/master/examples/tutor...
The main difference between Wasp and frameworks (e.g. Meteor, Blitz, Redwood) is that Wasp is a language, not a library. One benefit of that is a simpler and cleaner, declarative syntax, focused on the requirements and detached from the implementation details.
Another benefit of a DSL is that it allows Wasp to understand the web app’s requirements during the build time and reason about it before generating the final code. For example, when generating code to be deployed to production, it could pick the most appropriate architecture based on its understanding of the web app and deploy it to serverless or another type of architecture (or even a combination). Another example would be reusing your data model logic through all the parts of the stack while defining it just once in Wasp. DSL opens the potential for optimisations, static analysis and extensibility.
Wasp’s compiler is built in Haskell and it compiles the source code in Wasp + React/Node.js into the target code in just React and Node.js (currently in Javascript, but we plan to move to Typescript soon). The generated code is human readable and can easily be inspected and even ejected if Wasp becomes too limiting.
We are currently in Alpha and many features are still rough or missing, but you can try it out and build and deploy web apps! There are things we haven’t solved yet and others that will probably change as we progress.
You can check out our repo at https://github.com/wasp-lang/wasp and give it a try at Mobile App (iOS/Android) - generation is on the roadmap? ( using same metadata(DSL) ) As a junior dev I'd have loved this. Now, every instinct is telling me stay away. Right now, Wasp is already leaving big gaps to be filled in by JS/TS (Node, React), but there is also a big part that is abstracted away and hidden by Wasp. For that part, our main idea is to offer abstractions of different levels that you can choose from. For example, you can choose Wasp's RPC to communicate between backend and frontend, but nothing is stopping you to directly access request and response in your expressJS middleware if you want and write your own REST API or use GraphQL. Or, you can use our authentication system completely, or use just part of it, or completely ditch it. So there should always be a "lid" that you can remove and access the system beneath. That said, we are still figuring this out - where to offer escape mechanisms, how to organize them, how much to abstract certain parts - there is certainly some limit to flexibility that we can offer. What is cool that having our own DSL gives us a lot of freedom here (although it is also a lot of work!). One thing we do have in the meantime is ability to eject the code and continue with it if you get stuck with Wasp at this alpha stage -> it is actually human readable! I am not sure if we will be able to maintain that property as Wasp grows though, but we are not giving up on it for now. Longer term, we plan to add support for inline-JS, so you could e.g. mix JS and Wasp code (instead of just referencing js imports as it works now). We will also add some basic language constructs (expressions, conditionals, multiple wasp files) so we might get more similar to e.g. Starlark or Terraform's DSL. Do you have any examples or have experience with larger projects? For example, my React app has dozens of pages and some complex routing, and the backend has 50+ endpoints and talks to different databases, RabbitMQ, etc. When I see "shoe that fits all" solutions like this I'm honestly skeptical about the degree of freedom I get for more complex architecture needs. I've found frameworks like Next.js usually give you the freedom you need because it's basically pure JS. Also, this seems like it has a good opportunity to automatically integrate e2e/integration testing. I understand the skepticism, to be honest I was also pretty skeptical when we started (I am still a little bit, a healthy dose :D!), but we think now we can get to the level of flexibility of serious web frameworks - it all comes down to figuring out where the flexibility is needed. Right now it is already pretty flexible - you can write any nodeJS logic and use any JS library, same goes for React components. What is tricky is hitting this right trade-off between flexibility and power, and we are thinking a lot about that. So to summarize, I agree, but am hopeful! e2e testing -> yes, that would be very cool :)! We don't have any testing capabilities yet, but will be looking into it. Regarding bigger projects - one thing I am excited about is the possibility to model not just one web app via the DSL, but to capture multiple services - for example multiple (micro)servers - and orchestrate them. I haven't explored that direction enough yet though, since it is not the priority right now. GPT-3 -> WASP -> Web APP As you mentioned, that means it could be possible to generate Wasp DSL via other means as well, not just by writing it down directly (e.g. via a visual editor), and some specific parts could be even assisted by AI. For someone who want to build something fast and prevent themselves from repetitive tasks, they need to be very sure before jumping into a new wasp-lang codebase. We ourselves built a copy of Medium with Wasp - feel free to see it deployed here (https://wasp-rwa.netlify.app/) and check the code here (https://github.com/wasp-lang/wasp/tree/master/examples/realw...) For the super simple example with less code check out TODO app built with Wasp: https://github.com/wasp-lang/wasp/tree/master/examples/tutor... (check out main.wasp and then the code in ext/ folder) Hope this helps! It's about time we had a high level DSL for working with web abstractions. Our main drivers for creating a bespoke language were:
1. potential to create a completely tailored developer experience - as simple and nice as possible.
2. detaching from specific language - we want to be able to potentially support multiple languages in the future, especially on the backend. How do you see it as a DSL that is still Javascript - I would love to hear more! So like the main problem with this is like the long standing one of time...while I would actually love to work with a better way to build webapps with modern stack elements, no matter what relearning to do everything in Wasp will take at least a month. What if after all the time you discover an issue with the framework that prevents you from being able to complete your project? Is it possible to extend the included base libs and work natively if need be? I guess as long as devs have the ability to push Wasp aside and work directly with the libs, there is nothing that you could not eventually do. Just some quick thoughts but Im gonna give this a whirl this week. So while we still don't have this completely figured out (and I don't think we will until we get it done), we are hopeful! One cool thing is that doing our DSL also gives us a lot of freedom here, to find the best abstraction. Awesome, ping us on our Discord (https://discord.com/invite/rzdnErX) if you will have any questions - Wasp is still in early alpha and rough around the edges (including missing flexibility), so if you get stuck anywhere let us know! Actually ping us anyway if you wish, we would love to hear how you found the experience, how hard was it to get into it. I did take a quick look at the Wasp real-world app and was sort of disappointed. It seemed like a single file with lots of weird syntax that pulls in a regular old React app. Is there something I'm missing? True, right now it is just one file, and language is a simple "configuration", declarative language, just because we didn't need more so far. This is how we started, because we wanted to focus on capturing the basic abstractions of the web app at high level, and we want to keep the language as simple as possible -> so we decided to start really simple and then extend as we need more power. We will certainly add splitting into multiple files, and will probably go beyond that with actual modules, expressions, simple conditional logic, basic types and similar - kind of like meson (https://mesonbuild.com/Syntax.html) and Terraform.
Right now we don't see it ever becoming a Turing complete language, since we don't intend to capture the low-level logic in Wasp - we feel existing solutions are better fit for that (JS/TS/HTML/CSS/...) and we would not be doing our best work there, nor would we be able to keep up with the innovation. Although, never say never -> my mind does wander off to Mint (https://www.mint-lang.com/) every so and so, thinking if we could do something similar at some point -> but even if we do, that is further down the road. The authentication model is what I liked most. I think the biggest blocker is the use of Prisma however. I've never heard of Prisma before, and I'd have no problem using it. But I use DynamoDB for practically everything, not sure how that translates to that world. The second concern is that most of projects are written in Typescript. I'm not sure how this works with TS. I'd hate to write an entity twice - for example, a user entity, and a user interface in TS. Because they have to be typed anyways. Thanks Nikolas for answering regarding Prisma! The reason why we chose Prisma is because it is declarative, which plays really well with Wasp, and because it supports multiple types of databases - for now only relational, but as Nikolas said, in the future also nosql. Regarding TS - you are right, TS is a better fit for this than JS! We started with JS, but plan is to switch to TS real soon, for the reasons you described. Here is the Github issue discussing this: https://github.com/wasp-lang/wasp/issues/143 . If you don't mind me asking, how big is your team / what are you using right now to build web apps? As of today, we indeed only support relational databases (Postgres, MySQL, SQL Server, SQLite) but we are already working on a connector for MongoDB[1] and plan to expand to more DBs in the future, here's the open issue to support DynamoDB[2]. Hopefully Prisma becomes an option for you once we support your favorite DBs! [1]: https://www.notion.so/prismaio/Prisma-Roadmap-50766227b77946... Wowzer! For me, this is the main benefit. I'm a big believer in low-code platforms like darklang, because the fundamental truth that bugs are a function of both SLoC and underlying infrastructure is never going to change, and one solution to that is to automate as much of it as possible. The only problem I see is that these automations that eliminate code and abstract away the infrastructure often result in a new class of harder-to-debug or worse never-seen-before bugs. And so, building a language that "solves software engineering" may require a lot of patience and perseverance. With that in mind, how long do you plan to keep at it? How long term are you thinking you'd be doing this? I mean, you could still be working on wasp-lang whilst working full-time elsewhere... but then, that requires a different level of commitment when the business around it has failed. > Wasp’s compiler is built in Haskell Two questions, if I may: Why Haskell? Did you also consider OCaml (à la Rust) at some point? Edit: I see wasp-lang is MIT licensed. Why not Apache v2 (or even MPL v2)? Especially since MIT lacks patent-grants clause. Excited to see how wasp-lang evolves. Thanks! I also totally agree on being harder to debug, that is the challenge that comes with abstraction - at this stage we are not doing very much about it (mostly just propagating errors from server/client) but it is something we'll definitely need to focus on as Wasp matures. We chose Haskell because we had some previous experience with it and thought it would be a good fit for building a compiler (doesn't have a lot of realtime IO so we can keep the code simpler). Haven't yet tried OCaml or Rust (heard Rust is somewhat more low-lvl) but I believe they would be viable alternatives too. Re long-term doing Wasp - also agree, we believe this is a full-time job so that is why we joined YC and got the initial funding so we can focus on it longer term. Re Apache v2 vs MIT - thanks for letting us know! We haven't yet put much investigation into it but will definitely need to do it soon. All good, but what I really meant was, what happens when that funding money runs out and/or there's no business around wasp-lang to corner more investment? > Re Apache v2 vs MIT... Golang's BSD 3-Clause + patent-grant; and Rust's dual-licensed MIT (for compatibility with GPL v2, I believe) + Apache v2; whilst Clojure is EPL v1, though EPL v2 (+ the GPL compatibility clause) may also be a decent weak-copyleft choice for a programming language (ianal). See also: https://fossa.com/blog/open-source-licenses-101-apache-licen... https://opensource.com/article/17/9/facebook-patents-license Thanks for the info about licenses, awesome overview! Wasp is still in alpha so many things are rough or not there, including accessibility, but we do plan to handle it in the future! Here is relevant github issue: https://github.com/wasp-lang/wasp/issues/126 . This demo app isn't bad. The biggest problem I've found so far is that a screen reader user doesn't hear anything when a client-side page load happens. This is a common problem with SPAs, and there isn't a great solution for it. The best you can do right now is use an off-screen ARIA live region to announce something like "navigated to [page name]". Sometime though I'd like to work with the web standards community to standardize a better solution. Why doesn't screen reader detect it -> because URL does not change? What if SPA updates URL via history API, does that help? off-screen ARIA region sounds like something we could generate with Wasp automatically. Once we reach some level of stability, we plan to put more effort into accessibility -> if you wish, write a comment on our GH issue and we will be happy to include you in the effort when we work on it, help from somebody experienced with accessibility would be great. Would love to have a short chat about this in the near future, if you have time! I will have to check out React Admin, I haven't heard about it yet. Nothing makes me happier than seeing you guys having come so far since then and having stayed so determined! We would love to keep in touch, you shared a lot of great ideas with us - if you would consider joining us on Discord (https://discord.com/invite/rzdnErX) or shooting us an email at hi@wasp-lang.dev, it would be great :).
Thanks again for the support! What I quibble with is your solution. This is another layer on this cake of complexity that tries to hide the ugliness beneath rather than truly simplify. This sort of wrapping is rarely successful because eventually one of the underlying bits refuses to do its thing just as you’d hope and the house of cards comes tumbling down. I don’t think the crappiness of the cloud and webdev “stacks” can be rectified without a do over. I think it may need a rethink from the OS all the way up. Maybe right down to the hardware layer. I don’t think what’s there now is salvageable if we are hoping for a true shift in productivity. Btw, one thing that Wasp does in alignment with your idea of bespoke solution, is that it brings DSL that is in big part detached from the technology used for the implementation of the specific parts (JS/React/Node/...), meaning that if we get it working with existing technologies, we have one foot on the solid ground and can work from there to see which other, "smaller" problems can be tackled next, potentially ending up with a set of solutions that together create one new, bigger, bespoke solution. The opposite idea would be to build a single OS on top of distributed hardware that presents resources in a truly unified fashion where the illusion of programming and deploying to a single machine is unbroken and none of the underlying abstractions leak up. Think VMware but in reverse. The other thing that must be done over is the DOM/JS paradigm. It's so absurdly and ridiculously complex for what it does that it makes most developers laughable unproductive. There is no reason there couldn't be an environment like Delphi or VB but geared to the web developer. Wasm is a ray of hope here as its cutting loose the inane JS/DOM paradigm and finally offering a plain programmable canvas to the browser for the first time since the demise of Flash an Java applets before it. DOM/JS -> I think it now mostly came down to the paradigm of reactive programming, with React / Vue / Svelte.
What about Delphi and VB, what was so good about them? But the whole idea of mutating UI by changing the DOM via a script is a pile of needless complexity for 99% of the apps out there. A simple canvas with GUI components that fire callbacks would be way easier for most developers to work with. ....and then I saw that the page is still written using React and db access uses Prisma. They are not dependencies, you have to now about them, and their syntax and how they work. What is the incentive for me as a developer to learn both them and wasp? Especially since there are multiple places where the wasp layer is a thin layer over the underlying capability supported by those dependencies. Dont get me wrong. I say go bigger and make it a full-fledged DSL that generates react and prisma code without making them __visible at all__. That way nobody has to learn anything but wasp. Sure, you will be limited by whatever your underlying implementation layer is, but you can now switch from them easier, and its likely to last longer (there __was__ a time before React, and like will be one after too). Can you be the +1 layer that people dont have to look under? More specifically: 1. Can you have inline .js files? Even better: Can you bring the page content _into_ wasp's syntax? It currently says a webapp has pages and routes, how about expanding to say a webapp has components, elements and text? 2. Same question for storage schemas and migrations. Would that help with NoSQL integrations (vs expecting Prisma to support them)? 3. Can you eliminate the "Note:" sections in https://wasp-lang.dev/docs/language/basic-elements? Those are the leaks in the abstraction called wasp. And if the answer is no, then should there be a better abstraction? Web apps are complex beasts, and we believe there is a reason for multiple DSLs being used today (HTML, CSS, React/Vue/... as embedded DSL, Prisma as schema DSL + db access embedded DSL, Terraform, ...): it is easier to solve the problem by splitting it into subproblems and then solving each one of them with specialized language/DSL, than figuring out one DSL that works for everything. Even if we found one DSL that works for everything, it would at the end likely be a combination of multiple DSLs unified in one language. So, if we decided to solve it all at once with Wasp, we would be solving N problems at the same time, and would need to beat whatever is the current best solution in most of the areas to be compelling enough to be used. At the same time, we would be competing with the whole web dev ecosystem that has shown in the recent years to innovate and progress very quickly. That is why we believe more in the current approach we are having: by utilizing existing solutions for sub-problems, solutions that work relatively well and are on the edge of what we know is the best way of solving those sub-problems, and building our DSL in the space in-between, where the most of the friction is happening, we are bringing value where it matters the most while also riding the web dev ecosystem wave, instead of fighting it directly. This doesn't mean that we can't expand Wasp with additional sub-DSLs if we figure out at some moment that, e.g. we have a better abstraction than React that would fit really well in Wasp - we can still do all that, but we can do it step by step, while still progressing in the meantime. Also, this might not be very clear in the docs, but the idea of Wasp is not be tied just to React - idea is to also support Vue, Svelte, and whatever is coming next, when defining components. Also, idea is to support not just NodeJS, but also Go, Python and similar on the backend (maybe you could even combine them). Regarding learning -> is it better for a web dev to learn complicated Wasp language and how to write view logic in it and how to write db access logic in it, or to learn a simple, smaller Wasp language and how to write view/db logic in React/Prisma?
I think the second, since complexity is going to be similar in both cases due to Wasp becoming more complex in the first case, to be able to describe both view and db, while in the second case you are learning technologies that you can also use outside of Wasp later or you maybe even already know them. Just to make it clear, what you are suggesting, to have 1 DSL for all -> I love it, it is our initial vision, and one I would very much like to be possible. We actually started that way with our prototype, but soon concluded that we need to divide and conquer (well, more like delegate in this case) if we are going to win this battle. We started with having elements in DSL like button, forms, but we left those to React for now -> however, we will probably try getting back to that in the future, if we manage to establish some footing first. To answer the specific questions: 1. Yes! We are planning to relatively soon allow mixing of JS and Wasp logic, mostly for the purpose of making the code more readable and easier to organize. Describing lower-level details of the web app with Wasp, e.g. page content, elements, text -> that we would also like to do, but probably further in the future. 2. We initially started with our own syntax for describing schemas -> then we moved to Prisma since they have a DSL that works well. Right now we are working on our own Prisma DSL parser (almost done!), so that we can reason about those schemas independently of Prisma. Next step would be having our own syntax, which would make us independent of Prisma, as you said -> and ye...81 comments
[ 3.7 ms ] story [ 670 ms ] thread