Importing from PGN files
PGN (Portable Game Notation) is the standard format for chess games. En Croissant can import PGN files with advanced compression and encoding support.Open the Add Database dialog
Navigate to the Databases page and click the “Add Database” button in the top-right corner.
Choose your PGN file
Click “Click to select PGN file” and browse to your PGN file. Supported formats:
.pgn- Standard PGN text files.pgn.zst- Zstandard compressed PGN (recommended for large databases).pgn.bz2- Bzip2 compressed PGN
Configure database details
Enter a name and optional description. The name will be auto-filled based on the filename.
Import progress tracking
During import, En Croissant displays:- Number of games processed
- Processing speed (games per second)
- Estimated time remaining
- Real-time progress updates every 1,000 games
src-tauri/src/db/mod.rs:convert_pgn().
Supported PGN features
En Croissant’s PGN parser supports:- Standard headers
- Advanced features
- Encoding support
- Event - Tournament or match name
- Site - Location or platform (e.g., “lichess.org”)
- Date - Game date in YYYY.MM.DD format
- Round - Round number in tournament
- White/Black - Player names
- WhiteElo/BlackElo - Player ratings
- Result - Game outcome (1-0, 0-1, 1/2-1/2, *)
- TimeControl - Time control string
- ECO - Opening classification code
Batch import optimization
For optimal performance when importing large PGN files:- Disable indexes during import - Indexes are created after import completes
- Journal mode OFF - Maximizes write speed (set automatically)
- Foreign key checks disabled - Enabled only after completion
- Transaction batching - All games imported in a single transaction
- Parallel parsing - Uses multiple CPU cores for decompression
A compressed PGN file with 1 million games typically takes 5-15 minutes to import on modern hardware.
Importing from Lichess.org
En Croissant can import your games directly from Lichess using OAuth authentication.Initiate OAuth login
In the import dialog, select Lichess as the source and enter your Lichess username.
Authorize the application
Your browser will open to Lichess.org. Click “Authorize” to grant En Croissant access to your games.Scopes requested:
preference:read- Read your account preferences
Automatic token handling
En Croissant receives an OAuth token and uses it to download your games. The token is stored securely and reused for future imports.
OAuth implementation details
The OAuth flow is implemented insrc-tauri/src/oauth.rs:
En Croissant uses a local callback server that automatically closes after authentication. No data is sent to external servers.
Importing from Chess.com
Chess.com game import follows a similar OAuth flow to Lichess:- Enter your Chess.com username
- Authorize En Croissant in your browser
- Games are downloaded and imported automatically
Supported game types
Both Lichess and Chess.com imports include:- Rapid games
- Blitz games
- Bullet games
- Classical games
- Correspondence games
- Tournament games
- Casual games (optional)
Incremental updates
When re-importing from a source, En Croissant can skip games that already exist in your database:- Timestamp checking - Only imports games newer than the latest game in your database
- Duplicate detection - Automatically skips identical games
- Merge strategy - New games are appended to existing database
timestamp parameter in convert_pgn():
Pre-built databases
En Croissant offers curated databases for download:Master games database
High-level games from professional tournaments with full annotations.
Opening repertoire database
Specialized collections focused on specific openings and variations.
Historical games
Classic games from chess history, including world championship matches.
Computer games
High-quality engine vs. engine games for studying precise play.
.db3 format with indexes pre-generated for instant use.
Import error handling
En Croissant handles various PGN errors gracefully:- Recoverable errors
- Conversion handling
- Critical errors
Skipped with warning:
- Invalid FEN positions
- Illegal moves in game notation
- Missing required headers
- Corrupted move sequences
Performance tips
Use compressed formats
.pgn.zst files are 5-10x smaller than uncompressed PGN and import just as fast due to parallel decompression.Batch related imports
Import all related PGN files into a single database rather than creating multiple small databases.
Monitor disk space
The database will be approximately 30-40% the size of the uncompressed PGN file. Ensure adequate free space.
Import statistics
After import completes, the database Info table tracks:- GameCount - Total games in database
- PlayerCount - Unique players
- EventCount - Unique tournaments/events
- SiteCount - Unique locations/platforms
- Version - Database schema version