4 ms·
Show HN: Kretes – Build full-stack applications in TypeScript and PostgreSQL
- zaiste 6y agoHey HN, author here. Kretes is a tool for building full-stack applications in TypeScript and PostgreSQL with a goal to provide an integrated, battery-included and open-source solution for web development. It combines a web framework - similar to Rails, Django or Laravel - with a UI being built on top of the VS Code editor. It comes with a (eventually large) standard library of built-in modules that are developed in a coherent way e.g. authentication, authorization, admin panel [1] etc. This project explores the ideas introduced by the Self programming language and aims to bring them to the current age. The ultimate goal is to create a semi-visual tool for building web apps in a more intuitive way using just one programming language - TypeScript - on the client & on the server, and without the accidental complexity. The project started as a way to arrange my knowledge around JavaScript. Inspired by the past, I decided to replicate to some extend what Sun Microsystems did in ’95 with the Self programming language (a project I find underrated and ahead of its time), but using modern, popular tools such as JavaScript/TypeScript, VS Code, WebAssembly, PostgreSQL, etc. The project is in early alpha stage with the bus factor of (strong) 1. :) Happy to answer any questions here or at oh@zaiste.net* PS. I’m creating a todo app using Kretes on YouTube [2] to explain the bigger picture of building full-stack applications. IMHO it’s good to have a general understanding of how web applications work before* specializing in front-end or back-end - that’s the goal for this video series, and for Kretes. [1] not yet public [2] https://www.youtube.com/watch?v=rLAElFkRrWI&list=PLhXZp00uXBk5hnHEIAFl74mZyLrVKKJAD https://www.youtube.com/watch?v=rLAElFkRrWI&list=PLhXZp00uXB...
- debaserab2 6y ago> I decided to replicate to some extend what Sun Microsystems did in ’95 with the Self programming language For those of us unaware of what the Self programming language is/was, what things did you find inspiring that you are using in this framework?
- zaiste 6y agoI'd like to tightly combine a semi-visual programming editor, the tooling and the runtime/infrastructure into one «thing» as shown in this video [1]. You write a bit of code, you drag and drop another bit, and almost instantly it becomes «online» - the compilation / the deployment process are somehow hidden and the configuration is minimal. It just works, so you can focus on solving the actual business needs of your application - but that's a long term vision... ;) I must mention DarkLang [2] that seems to have a similar goal, but a different approach: Kretes builds on top of VS Code, and uses one of the most popular programming languages while DarkLang builds not only their editor from scratch, but they also introduced a new programming language. I find their project ambitious and inspiring - a potential game changer imho [1]: https://www.youtube.com/watch?v=Ox5P7QyL774 https://www.youtube.com/watch?v=Ox5P7QyL774 [2]: https://darklang.com/ https://darklang.com/
- livre 6y agoThis project looks very useful. Since you compare it to Django and mention it has batteries included i have a few questions I'd like to ask. Does it include an autogenerated admin page like Django? Does it handle database migrations? You mention both Vue and React in your page, does that mean I have to install either of them manually or does the cli handle that? What are the limitations of the query builder? I can't test anything right now and the docs page looks a bit bad on my phone. Also the examples page is broken and returns an error.
- zaiste 6y agoThanks for the kind words! 1. I'm working on the admin panel, but it's not yet ready. I'm still hesitating how to approach the persistence layer without introducing too many abstractions. Generally speaking, I'd like to avoid ORMs as much as possible. :) 2. I use the node-pg-migrate [1] for migrations at the moment, but I plan to tightly integrate with Postgraphile / Hasura to give another approach for that part. 3. You need to add them manually, but the architecture is pretty close to Vite [2]. You have just one Node process for both front-end & back-end: in development I compile assets on the fly using ESBuild [4], in production I bundle them using Rollup. I should probably describe that in the docs more clearly :) In contrast to Vite, Kretes also provide a REST API out-of-the-box, and a relatively simple path for adding a GraphQL endpoint. 4. The current query builder - sqorn [5] - has a nice syntax as it uses the same vocabulary as SQL, but it's not typed. My goal is to create a fully typed TypeScript query builder that's adapted only for PostgreSQL. Here's the preliminary work for that [3] 5. I'm still working on the docs. I'll fix the things you mentioned right away. [1]: https://github.com/salsita/node-pg-migrate https://github.com/salsita/node-pg-migrate [2]: https://github.com/vitejs/vite https://github.com/vitejs/vite [3]: https://github.com/typeofweb/functional-orm https://github.com/typeofweb/functional-orm [4]: https://github.com/evanw/esbuild https://github.com/evanw/esbuild [5]: https://sqorn.org/docs/about.html https://sqorn.org/docs/about.html
- livre 6y agoThank you for the very informed reply. I think your project has a great future if you keep working on it. A fully typed query builder sounds amazing, the weakly typed one of Django bit me once back when I was getting started with it.
- tango12 6y agoCongrats! I see that Kretes uses Sqorn [1] for talking to the database. I really like the looks of Sqorn, however iiuc, it doesn't support typescript right? How does that piece work? [1] https://github.com/sqorn/sqorn https://github.com/sqorn/sqorn
- zaiste 6y agoHello Tanmai :) Yes, exactly. It's not typed and also not actively maintained. The goal is to have a fully typed query builder that's adapted only to PostgreSQL. Here's the preliminary work for that [1]. I would also like to find a way to fully integrate with Hasura [1]: https://github.com/typeofweb/functional-orm https://github.com/typeofweb/functional-orm
- tango12 6y agoHey Zaiste! I missed your name as OP :) That looks like a really good start. Do you think it'll end up looking like JOOQ? Would be interesting to see how you get things like aggregations and perhaps even things like: `SELECT 1, 'hello'` to work. That would be the ultimate test! Happy to help with any Hasura integrations whenever you're ready too! Let's chat again soon. :)
- zaiste 6y agoYes, our discussion a few weeks ago pushed me further to explore this topic. JOOQ is exactly what I'm looking for JavaScript/TypeScript. It's just a matter of having enough time ;) Thanks for the proposition regarding Hasura integration. Happy to chat soon. Good luck with everything.
- liminal 6y agoThat Postgres query library could be the most broadly useful part of the whole stack. Also looks like a big job! Best of luck!
- nsonha 6y agoThe choice of both Tailwind and Postgraphile makes me want to throw up. The two things are on the top of my hyped techs list. They're geared toward PERSONAL productivity at the expense of maintainable styles and good API design, respectively. Nestjs has been around or a while and support a ton of tranports not just graphql btw.
- leetrout 6y agoNest is popular in some of the Angular circles but the projects I've seen use it are just as unwieldy as any other language / framework with out disciplined devs. Do have particular complaints about Postgraphile that Nest has a better solution for (when constrained to GraphQL, which the author states is a goal)?
- nsonha 6y agoIt's just a framework that helps you productive with enough options to not be opinionated (such as constrained to graphql). I would not use a "framework" myself though. The only thing in frameworks that I used to find useful was the IoC container but then I realised composition roots are enough. The issue here has nothing to do with how PostGraphile is implemented though, I've heard many people complimenting it for being better than alternatives. However the very idea of generating API from DB is problematic because that forces API consumers to think in term of DB operations not business processes. Most likely business logic will be leaked down to clients, or have to be managed in some convoluted way (Hasura actions).
- BenjieGillam 6y agoPostGraphile maintainer here; what you’ve said is not really true for PostGraphile - we give you a huge toolbox of ways to customize, shape and extend your schema so it’s designed for consumers to consume rather than just being a way of exposing your database over GraphQL (which I agree is not necessarily the right goal in many cases). It does encourage you to put your business logic in the database, but you can also do logic in JS/TS if you see fit with our powerful plugin system and range of plugin factories for common tasks, such as makeExtendSchemaPlugin for adding your own types and resolvers. It constructs a GraphQL schema using the reference implementation so you can then use the schema with other tools if you like. For an example GraphQL schema that’s client focussed, see: https://graphile-starter.herokuapp.com/graphiql https://graphile-starter.herokuapp.com/graphiql . I care deeply about building high quality GraphQL schemas; this is one of the reasons I contribute to the GraphQL Spec itself.
- MH15 6y agoI'd be interested in contributing to this project. I'm going to poke around the codebase and see if there's anything I'd be able to help with. Reply if you have anything in mind!
- zaiste 6y agoWow! That would be awesome. I'd like to finish with the on-the-fly compilation that uses ESBuild. This approach is similar to Vite and Snowpack. I wanted to integrate it with React/Preact and Solid.js in the next few weeks. Any help with that would be appreciated. I also plan to rewrite the core to Deno. It will be relatively simple, but a bit mundane. ;)
- gitgud 6y agoWhy does this depend on both Reactjs and Vuejs aren't they essentially the same thing?
- zaiste 6y agoYes, they are essentially identical, it's about giving a choice. Also, those libraries focus (mostly) on the front-end part. In Kretes, I'd like to provide tools/methods that cover the whole stack so to speak. This is especially visible for newcomers. A Vue.js tutorial may show you how to build the UI, but then you need to figure out how to bring in and persist the data, or how to connect to an API, etc. This isn't to say that such article should cover everything, but I have an impression that the industry requires or rather forces specialization too early, i.e. before people have a chance to understand the big picture. Kretes is about arranging different pieces together so that they are ready to use right away, even if you know how to configure them on your own, you don't need to and can focus on solving the actual business needs of your application. Disclaimer: As the project is in early alpha, this promise is not yet fully fulfilled. :)
- namelosw 6y agoSounds very promising. I try it out tonight. I'm always wondering people are not interested in powerful interactive development environments anymore. Like those environments for Smalltalk and Common Lisp. Modern development sucks. I hope there would be more things like this.
- zaiste 6y agoThanks! The environments introduced by Smalltalk, Self - and Racket, if we talk Lisp ;) - are one of major inspirations for this project. Another idea is to focus more on the JavaScript prototypical nature, instead of adapting solutions or design patterns from programming languages such as Java or C# as OOP is different in JavaScript. The project, however, is in early alpha, still far from being close to a programming environment per se.