Open Source Friday with AdonisJS creator Harminder Virk

By GitHub

TechnologyStartupBusiness
Share:

Key Concepts

  • AdonisJS: An opinionated, full-stack JavaScript framework for building backend-heavy applications.
  • Lucid: The default Object-Relational Mapper (ORM) used by AdonisJS.
  • Type Safety: A key design principle in AdonisJS, ensuring type consistency from backend to frontend.
  • High-Level Abstractions: Simplified APIs that allow developers to perform complex tasks with minimal code.
  • MVC Framework: Model-View-Controller architectural pattern.
  • Open Source Sustainability: The challenges of maintaining an open-source project long-term, especially without a business model.
  • Community Governance: How open-source projects manage contributions and maintain a shared vision.

AdonisJS Framework Overview

Motivation and Pain Points Addressed

Harinder, the creator of AdonisJS, was motivated by the need for a JavaScript framework that provided a similar out-of-the-box experience to Laravel (PHP). He found that using Express.js required significant setup and configuration for each new project, including selecting and wiring up ORMs and validation libraries. AdonisJS aims to solve this by providing a comprehensive set of tools and libraries, allowing developers to focus on building features rather than infrastructure.

Request Flow and Core Components

  1. Routes: Defined in the routes file, these map URLs to specific controller actions.
  2. Controllers: Handle incoming requests, interact with the ORM, and render templates. Example: PollsController with actions like index, create, and store.
  3. Lucid ORM: Used to interact with the database. Models represent database tables (e.g., Poll model).
  4. Validators: Ensure data integrity and type safety. Example: Unique rule for email validation.
  5. Templates: Rendered using libraries like Inertia.js, often with React components.

Type Safety and End-to-End Integration

AdonisJS emphasizes type safety throughout the application. Types are inferred from the backend and propagated to the frontend, ensuring consistency and reducing errors. This is particularly useful when working with data models and API responses.

Opinionated Approach and Full-Stack Capabilities

AdonisJS is an opinionated framework, meaning it enforces certain conventions and best practices. This is inspired by MVC frameworks like Laravel and Rails. The framework takes a full-stack approach, providing tools for both backend and frontend development.

Design Decisions and Differentiators

  • Type Safety: Prioritizes type safety through TypeScript integration.
  • High-Level Abstractions: Offers simplified APIs for common tasks like authentication and data validation. Example: Authentication logic condensed into a few lines of code using the o object.

Use Cases

AdonisJS is well-suited for building backend-heavy applications, such as SaaS platforms, that require database interactions, background jobs, and email integration. It is particularly beneficial for developers who appreciate opinionated tools and value type safety.

Harinder's Journey and Open Source Experience

Early Development and Inspiration

Harinder's journey began with PHP in 2008-2009, building a social platform for French learners. He transitioned to JavaScript after joining a company that required Node.js development. He was initially drawn to Laravel for its out-of-the-box features.

First Open Source Contribution

Harinder's first open-source contribution was ng CLI, an Ember CLI-like tool for Angular. This experience sparked his interest in building and contributing to open-source projects.

Learning and Inspiration

Harinder primarily learns by exploring codebases of other successful frameworks and libraries. He studies their abstractions, problem-solving approaches, and GitHub issues to understand common challenges and solutions.

Balancing Community Contributions and Framework Vision

Harinder emphasizes the importance of setting expectations with contributors. He encourages discussions before large feature contributions to ensure alignment with the framework's vision. He also highlights the long-term maintenance burden of accepting new features.

Valuable Contributions

Valuable contributions to AdonisJS include:

  • Building ecosystem packages that extend the framework's functionality.
  • Creating learning content, such as tutorials and documentation.
  • Fixing bugs and improving existing features.

Community Governance and Growth

Community governance involves identifying passionate contributors and involving them in core team decisions. Roman, a core team member, grew the community through Twitch streams. Community growth has been largely organic.

Sustainability and Motivation

Sustainability is a challenge for open-source projects without a business model. Harinder's motivation stems from his belief in AdonisJS and his continued use of it for his own projects.

Burnout and Stepping Away

Harinder experienced burnout in 2018 and considered stepping away from the project. However, working on a startup's MVP reignited his passion for AdonisJS.

Underappreciated Aspects of Open Source Maintenance

Maintaining an open-source project is more difficult than building it. It requires careful consideration of breaking changes, compatibility, and security. Fixing bugs and maintaining existing features is often less glamorous but equally important.

Future Roadmap and Technical Vision

Core Pieces

The core pieces of the framework will remain largely the same, with ongoing improvements and adoption of new Node.js features.

High-Level Tools

Harinder plans to invest more time in creating high-level tools on top of the framework. One idea is a development monitoring tool that provides insights into request performance, database queries, and template rendering.

Advice for Developers Building Tools/Frameworks

  • Right Motivation: Build tools to solve your own problems.
  • Say No: Don't hesitate to reject contributions that don't align with the project's vision.
  • Scratch Your Own Itch: Building a solution for a problem you face provides motivation and guidance.

Notable Quotes

  • "Maintaining the thing is like far more difficult than building it."
  • "If you scratch your own itch, I think it helps you in two ways... it becomes the guiding light of what you want to do... and second, it helps you stay motivated."

Technical Terms

  • ORM (Object-Relational Mapper): A technique that lets you query and manipulate data from a database using an object-oriented paradigm.
  • MVC (Model-View-Controller): An architectural pattern that separates an application into three interconnected parts: the model (data), the view (user interface), and the controller (logic).
  • TypeScript: A superset of JavaScript that adds static typing.
  • Inertia.js: A library that allows you to build single-page applications using server-side routing and rendering.

Synthesis/Conclusion

Harinder's journey with AdonisJS highlights the challenges and rewards of building and maintaining an open-source framework. AdonisJS stands out for its opinionated approach, type safety, and high-level abstractions, making it a compelling choice for developers building backend-heavy applications. The framework's success is attributed to Harinder's passion, community involvement, and commitment to solving real-world problems. His advice to aspiring tool builders emphasizes the importance of building solutions for personal needs and maintaining a clear vision for the project.

Chat with this Video

AI-Powered

Hi! I can answer questions about this video "Open Source Friday with AdonisJS creator Harminder Virk". What would you like to know?

Chat is based on the transcript of this video and may not be 100% accurate.

Related Videos

Ready to summarize another video?

Summarize YouTube Video