Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now
Build the future of communications.
Start building for free
  • By Maciej Treder
    Protecting JavaScript Microservices on Node.js with JSON Web Tokens and Twilio Authy Copy of Product Template - Authy.png

    Building a JavaScript application on Node.js with a microservices architecture gives you the ability to scale your app: you can respond to varying load levels by adding and removing instances of a service. When multiple instances of a service access the same data, your application can use a common persistence layer, a database, to share information between instances and maintain consistency between them.

    In many applications you'll also want to limit access to some data and functions to particular users. While you could do this directly in your service APIs, there's a better way.

    This post will show you how to add two-factor authentication (2FA) with Twilio Authy and an authorization web service using JSON Web Tokens (JWTs), a standard for securely storing and transmitting sensitive data.

    Authentication with Twilio Authy

    Twilio Authy uses push authentications to verify a user's identity. Push authentications are better than passwords because they require …

    Read More
  • By Maciej Treder
    Scaling Node.js JavaScript Microservices on Shared MongoDB Atlas Cloud Persistence Layers SJnUOPvxV61fRcmv5Yt-pzFgX-lGmYhj6_t5HI-kLrenVH2eaKj_h56yuKtqiApJSH1HLQLmURnIvDX0i03ZqZ87q9iK_D3UVJ2SRZD3YmgG0EOhztC_Gm3oWYQJ-EP93TMqIDee

    Building a JavaScript application on Node.js with a microservices architecture gives you the ability to scale your app to respond to increasing load levels by adding more instances of a service. But when multiple instances of a service work with the same data your application will have an additional design requirement: you'll need a persistence layer the service instances can use to store and share data.

    This post will show you how to use a database as a persistence layer for a JavaScript microservices application. You'll see how the application uses Netflix Eureka and Netflix Zuul for service discovery and load balancing. You'll be able to apply the techniques you learn here to build applications you can scale up and scale out while avoiding the complexity of building service discovery and load balancing on your own.

    You'll also get a hands-on introduction to working with MongoDB Atlas as a database-as-a-service …

    Read More
  • By Maciej Treder
    Implementing Eureka and Zuul for Service Discovery and Dynamic Routing in JavaScript Microservices Running on Node.js Gw87W418humMuagmwCQwtUyO2SOfwrWPG7TdI2vz7z_y86RFhQPQorXMBTcuPGWz1qCgkzBfvzX51Lgf1K1y493wa4Apwoq-y0zQf8Sig9UDXo5XaZi-y_YdGYoecOCIvX4Jfawz

    Building your JavaScript applications as a collection of microservices give you a number of advantages. Your applications can be more modular, uniform, and testable as you build them and they can be more robust, scalable, and available when you deploy them to the production environment. Including a service discovery registry and dynamic routing capabilities will help you achieve scalability and availability in the production.

    This post will show you how to integrate service discovery and intelligent routing into a Node.js application built with a microservices architecture. You'll see how you can do this with two Netflix open source projects, Eureka and Zuul, that run in the Java SE Runtime Environment.

    The Netflix Eureka server provides service discovery. This gives your application's services the ability to find other services without knowing where they are hosted or the full URL required to reach them, so you don't have to provide complete URLs …

    Read More
  • By Maciej Treder
    Building JavaScript Microservices with Node.js mUCiZxpOc_8QJwGWjnL-3laEHBvVPsWFUUaaqEwngtHx6dvVh4OCSHt930RA_L321CXXwCN0MkX_duBXkbyACYCVNsBFUCM09cLYxG3Q8hp0AkaSIdo4e_LyZfPj-EFr9davE6U5

    When your JavaScript application grows in size you start facing challenges with maintaining the code, fixing bugs, and implementing new features. Also, adding new developers to the project becomes complicated.

    Applications are built from pieces, like packages and modules, but at some point those structures aren’t enough to reduce the size and complexity of the application. The idea behind distributed systems is to break big, monolithic designs into small, independent programs which communicate with each other to exchange data and perform operations.

    One of the many variants of distributed systems is the microservices architecture, which structures an application as a collection of loosely coupled services. Services are fine-grained and the communication protocols are lightweight (like the HTTP protocol).

    There are few things worth emphasizing about the superiority of microservices, and distributed systems generally, over monolithic architecture:

    • Modularity – responsibility for specific operations is assigned to separate pieces of the application …
    Read More
  • By Maciej Treder
    Encrypting Cookies with Angular Universal and Node.js Angular Universal

    Cookies are a ubiquitous feature of web applications, as anyone clicking GDPR notifications for the last several months has realized. Securely handling the data in those cookies is just as much a requirement as the consent notification. Encrypting your Angular and Node.js application cookies is a way to prevent unauthorized access to confidential and personal information, and it’s easy to implement.

    As you know, using an httpOnly cookie helps prevent cross-site scripting (XSS) attacks. (You can learn more in another post.) But what about protecting one registered user’s data against another registered user? Are cookies vulnerable to attacks from trusted users?

    This post will demonstrate how authenticated users can get unauthorized access to other users’ cookie data. It will also show you how to encrypt your cookies so the data can only be read by your code, not by users.

    The code in this post uses the cryptography library in …

    Read More
  • By Maciej Treder
    Building Expedited Two-Factor Authentication into Angular Apps with Authy Angular and Twilio logos

    Two-Factor Authentication (2FA) provides web applications with an important additional layer of security, but 2FA requires the user to perform an additional action each time they log in. This extra step can be wearying for users who sign into an application frequently. Is it possible to maintain the security provided by a second factor while making an application convenient for repeat visitors? It is with Angular, Node.js, and Twilio Authy.

    Implementing a “remember me” checkbox on the login page is a convenient way for a user to indicate they are going to be a repeat visitor. Behind the scenes, an encrypted security cookie is a convenient mechanism for identifying a user who has previously checked the “remember me” box and logged in successfully from a specific machine.

    With Twilio Authy and an encrypted cookie, such as a JSON Web Token (JWT), you can make the sign-in process fast and …

    Read More
  • By Maciej Treder
    How to Transfer Files and Data Between Angular Clients and Node.js Backends scuYOAhIEQ4GEH19vMrkLXpit7Ajvupr2OCDcoUBbmZ3txEtpae8CAfBA9Hu2kkQk8B60YVwNeDBu-EbZO9F7sk4fDibyz5aVm2-V-y8JXCB5C5qe16XjTGbB7Um9GgPnUClUzZ2

    Having a shared codebase for both the server-side and browser-side code of an Angular application aids the maintainability of a project. You can do that with Angular Universal and Node.js using the server-side rendering (SSR) concept. You can even use SSR to securely pass data, including files, between the application server (Node.js) and the Angular application running on it.

    This post will show you how to create an application for uploading, storing, managing, and downloading files from a Node.js server using a single codebase. When you finish this project you’ll be able to:

    • Create an Angular application
    • Set up server-side rendering with Angular Universal and Node.js
    • Implement file transfer operations
    • Create a dynamic, in-memory list of files
    • Pass data about storage content between the server application and the JavaScript used by Angular for SSR

    To accomplish the tasks in this post you will need the following:

    Read More
  • By Maciej Treder
    Build Two-factor Authentication in Angular with Twilio Authy Y8iaichVZvJMIIzZ-Bghjj0321PVkb8TkqdFwexxbf9-wZjp5JHbmtJJ_yc2GPPFMDpw3ZWW3NJXZNiPpiUBFtt3pu16hJrY7JU0jn7O8cWf7-WR88AySSuEmfah9qbrsjJdHuug

    User authentication is a crucial requirement for many Angular applications and simply logging in with user ID and password is increasingly inadequate security. Two-Factor Authentication (2FA) provides device-based security that is substantially more difficult to hack, but building your own 2FA system is a daunting challenge. Twilio Authy makes it easy to add 2FA to Angular apps.

    This post will show you how to add Authy to your Angular project. You’ll also learn how to improve the user’s experience and your app’s security by using Angular Universal to implement the login process.

    In this post we will:

    • Create a basic Angular application with a login page
    • Set up an authorization guard service and an authorization service
    • Add server-side rendering with Angular Universal
    • Set up server-side authentication
    • Implement two-factor authentication with Twilio Authy

    Prerequisites to build with Angular and Authy

    To accomplish the tasks in this post you will need the …

    Read More
  • By Maciej Treder
    Build Faster JavaScript Web Apps with Angular Universal, a TransferState Service and an API Watchdog angular-seo.jpg

    Search Engine Optimization (SEO) is vital for most web applications. You can build SEO-friendly Angular apps with Angular Universal, but what about the performance and efficiency of such an application? This post will show you how to build fast Angular apps that use client and server resources efficiency while providing server-side rendering (SSR) for SEO purposes.

    In this post we will:

    • Create an Angular application
    • Add server-side rendering with Angular Universal
    • Set up an HTTP_INTERCEPTOR with a TransferState service, to prevent duplicate calls to server resources
    • Create a route resolver to protect against slow external APIs.

    To accomplish the tasks in this post you will need to install Node.js and npm (The Node.js installation will also install npm) as well as Angular CLI. cURL for macOS, Linux, or Windows 10 (included with build 1803 and later) and Git are referred to in the instructions but …

    Read More
  • By Maciej Treder
    How to Create Search Engine-friendly Internationalized Web Apps with Angular Universal and ngx-translate PTBBJHTzrgC4ttDQK9QXhHyWjhQEnYEBqkXVQHX2fSunZYRm0gbavoI7HKljyTgoo9LwOSLBsuxPhnfN-bxaYc0O3N3QMvI7ELqCMITXkKdASl7WVDNWt3kRytBo7PNsd2PBck29

    Search Engine Optimization (SEO) is important for many Angular single-page applications (SPAs). You can build SEO-friendly Angular websites with Angular Universal, but how do you make your app SEO-friendly in every language your website supports? Google, Yandex, and Baidu, might request your pages in English, Spanish, Russian, or Chinese: how do you make your server-side rendering return the correct language?

    The answer is ngx-translate, the internationalization (i18n) and localization library for Angular. This module makes it easy to use translation files that provide the correct language for both client-side and server-side rendering. This post will show you how to use it.

    In this post we will:

    • Create an Angular application with one component, the home page
    • Add server-side rendering for SEO purposes with Angular Universal
    • Set up internationalization in four languages with ngx-translate

    To accomplish the tasks in this post you will need to install the following: …

    Read More
  • Newer
    Sign up and start building
    Not ready yet? Talk to an expert.