20 ms·
Launch HN: Wasp (YC W21) – DSL for building full-stack web apps
Hi HN!
We are Martin and Matija, twin brothers and creators of Wasp (https://wasp-lang.dev 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/tutorials/TodoApp/main.wasp 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 https://github.com/wasp-lang/wasp and give it a try at https://wasp-lang.dev/docs/ https://wasp-lang.dev/docs/.
Thank you for reading! We would love to get your feedback and also hear about your experiences building web apps - what has worked for you and where do you see the opportunities for improvement?
- pella 6y agoQuestion: Mobile App (iOS/Android) - generation is on the roadmap? ( using same metadata(DSL) )
- Martinsos 6y agoYes, that's the idea! We first want to get the web app part working really well, and then we will be looking into adding mobile. It will certainly require extending the DSL though, to capture both web and mobile specifics, but the idea would be to keep it as general as we can.
- bnr 6y agoThat link does not work, Page not found: https://wasp-lang.dev/docs/tutorials/getting-started https://wasp-lang.dev/docs/tutorials/getting-started
- matijash 6y agothank you, fixed! The correct link is https://wasp-lang.dev/docs/ https://wasp-lang.dev/docs/
- deleted 6y ago[deleted]
- zibbity-rw 6y agoThis is brilliant! Do you have any resources or thoughts to share on designing DSLs? Mad respect for people doing this.
- Martinsos 6y agoWoah thanks :)! We had previous experience with writing a compiler for subset of C (during uni), and I also did some learning from the "Crafting Interpreters" book, but regarding the DSL design, I would say it is actually simpler -> we just went kind of ad-hoc and are expanding syntax as we figure out what we need. I am not sure if that is the best process, I would love to learn about the better one if there is one, but it worked so far. Wasp is still pretty simple, really not much more expressive than JSON at the moment, but we hope to add more stuff soon. While we are using parser combinators right now to parse the language, which is pretty manual process, once it becomes clearer what the language looks like, we will look into capturing it with formal grammar and then use some of the more advanced tools to parse it. The book I am going through right now is "Language Implementation Patterns" by creator of Antlr, it has chapters specific for designing DSLs!