```import typesense from 'typesense'; const clien...
# community-help
a
Copy code
import typesense from 'typesense';

const client = new typesense.Client({
      nodes: [
        {
          host: 'x5eqa*****<http://szp-1.a1.typesense.net|szp-1.a1.typesense.net>', // For Typesense Cloud use <http://xxx.a1.typesense.net|xxx.a1.typesense.net>
          port: 443, // For Typesense Cloud use 443
          protocol: 'https', // For Typesense Cloud use https
        },
      ],
      apiKey: 'K7W6z*********quAwYbA4onyLG',
      connectionTimeoutSeconds: 5,
    });

    const booksSchema = {
      name: 'books',
      fields: [
        { name: 'title', type: 'string' },
        { name: 'authors', type: 'string[]' },
        { name: 'image_url', type: 'string' },
        { name: 'publication_year', type: 'int32' },
        { name: 'ratings_count', type: 'int32' },
        { name: 'average_rating', type: 'float' },
      ],
      default_sorting_field: 'ratings_count',
    };

    client.collections().create(booksSchema);