Appearance
First Example
This guide takes you from zero to a running Squizy application. Follow every step and you will have a working app with Google login and a fully managed entity.
1. Generate the Project
Go to start.squizy.io — the Squizy project initializer. It works like start.spring.io but pre-configured for Squizy.
- Fill in your project metadata (group, artifact, package name)
- In Dependencies, add OAuth2 Database and H2 (in-memory database for development)
- Click Generate Project to download a
.zipfile - Extract the archive and open it in your IDE
2. Set Up Google OAuth2 Credentials
Squizy uses OAuth2 for authentication. You need a Google OAuth2 client:
- Go to the Google Cloud Console
- Create a new project (or select an existing one)
- Navigate to APIs & Services → Credentials
- Click Create Credentials → OAuth 2.0 Client ID
- Select Web application as the application type
- Under Authorized redirect URIs, add:
http://localhost:8080/login/oauth2/code/google - Click Create and copy the Client ID and Client Secret
TIP
If prompted to configure the OAuth consent screen first, select External, fill in the required fields (app name, user support email), and save. You can leave it in "Testing" mode for development.
3. Configure the Application
The only configuration you need is Google OAuth2. Edit src/main/resources/application.properties:
properties
# Google OAuth2
spring.security.oauth2.client.registration.google.client-id=YOUR_CLIENT_ID
spring.security.oauth2.client.registration.google.client-secret=YOUR_CLIENT_SECRET
# JWT token seed (use any random string; keeps tokens valid across restarts)
squizy.oauth2.token-seed=change-me-to-something-randomReplace YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with the values from Google Cloud Console. Everything else (datasource, JPA settings) works out of the box with the H2 dependency you selected.
4. Enable Auto-Create Users
By default, Squizy rejects users that don't exist in its database. For this quickstart, configure auto-creation so that any Google user can log in and get a User role automatically.
Create a class in your project:
java
package com.example.myapp;
import io.twentyninetech.squizy.security.oauth2.database.SquizyGeneratedUsersDetailsProvider;
import io.twentyninetech.squizy.security.oauth2.database.GeneratedUserDetails;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class AutoCreateUsersProvider implements SquizyGeneratedUsersDetailsProvider {
@Override
public List<GeneratedUserDetails> getInitializationUsersDetails() {
return List.of();
}
@Override
public List<String> getOnDemandNewUserRoles(String email) {
return List.of("User");
}
}With this in place, when a user logs in with Google for the first time, Squizy automatically creates the user record and assigns the User role.
5. Define an Entity
Create a JPA entity annotated with @SquizyEntity. This is all Squizy needs to generate the full CRUD API and UI:
java
@Entity
@SquizyEntity(displayFormat = "${name}")
public class Product {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
private String name;
private String description;
@NotNull
private BigDecimal price;
// getters and setters
}Three fields, three different column types in the generated UI — text, long text, and number. Squizy handles the rest.
6. Run the Application
Start the application:
bash
./mvnw spring-boot:runOpen http://localhost:8080 in your browser. You will be redirected to Google's login page. After signing in, Squizy creates your user and you land on the application with a fully functional Product management view — table, create/edit forms, filters, search, and export — all generated from that single entity.
Next Steps
- Explore entity configuration and field options
- See all available features
- Learn about authentication in detail