Design apps

As you come up with ideas for applications, you are going to make many design decisions about how to structure and organize your project. Most of these design decisions are independent of whether you deploy your app on a traditional cloud service or on the Internet Computer. However, if you are going to deploy on the Internet Computer, there are a few design decisions that you should pay particular attention to as you plan the implementation for your app.

Single or multiple canister architecture

One of the first decisions you might want to consider when designing your application is whether it should be encapsulated in a single canister or consist of multiple canisters.

For example, if you are writing a simple service with no front-end, you might want to use a single canister to simplify project management and maintenance and focus on adding features. If your application has both front-end assets and back-end business logic, your project is likely to consist of at least two canisters, with one canister for managing user interface components and another canister for the backend services the application provides.

In planning, you might also consider placing some common reusable services in their own canister so that they can be imported and called from other more-specialized canisters or made available for other developers to use. The LinkedUp sample application illustrates this approach by splitting the professional service application into two canisters. In the LinkedUp example, the functions that establish social connections are defined in the connectd canister and separate from the functions used to set up professional profiles that are defined in the linkedup canister. It is easy to imagine extending the application with a third canister, for example to schedule events based on profile attributes or shared connections.

Segregating actors from types and utilities

Using query calls

Data storage and retrieval

For many applications, databases are primarily used to provide long term storage of records that can be retrieved efficiently using one or more key fields. On the Internet Computer, this use case is usually addressed through data structures like hash tables. Instead of a traditional database, the Internet Computer enables you to use stable memory to handle long-term data storage—often referred to as orthogonal persistance—and to use query calls to retrieve your data. Although this approach works for most applications and simple key value database requests it doesn’t fully emulate a relational database.